GrapeCity MultiRow Windows Forms Documentation
PrintHeader Property
Example 


Gets or sets a value that indicates how to print the column header.
Syntax
<RefreshPropertiesAttribute(RefreshProperties.Repaint)>
<DefaultValueAttribute()>
<SRDescriptionAttribute("Indicates how to print the column header.")>
Public Property PrintHeader As PrintHeader
Dim instance As PrintSettings
Dim value As PrintHeader
 
instance.PrintHeader = value
 
value = instance.PrintHeader
[RefreshProperties(RefreshProperties.Repaint)]
[DefaultValue()]
[SRDescription("Indicates how to print the column header.")]
public PrintHeader PrintHeader {get; set;}

Property Value

One of the PrintHeader values. The default is PrintHeader.FirstPage.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentExceptionThe specified value is not one of the PrintHeader values.
Remarks

This property has a similar function as the ColumnHeaderSection.PrintPagesMode property, the difference is the ColumnHeaderSection.PrintPagesMode property only controls its own section. And the ColumnHeaderSection.PrintPagesMode property has a higher priority level than this property. If the ColumnHeaderSection.PrintPagesMode property is None, this property takes effect.

The print effect is determined by PagingMode.

PagingMode Print Effect
PagingMode.SingleRow When PrintHeader and PrintFooter are AllPages, each page contains the header, footer, and one row. When PrintHeader is FirstPage and PrintFooter is LastPage, only the first page contains a header and only the last page contains a footer. Other pages do not have a header or a footer. When PrintHeader and PrintFooter are None, the pages do not have a header or footer.
PagingMode.Flow When PrintHeader and PrintFooter are AllPages, each page contains the header, footer, and some rows. When PrintHeader is FirstPage and PrintFooter is LastPage, the header is printed at the beginning of the first page and the footer is printed at the end of the last page. Other pages do not have a header or footer. When PrintHeader and PrintFooter are None, pages do not have a header or footer.
PagingMode.MultiColumns When PrintHeader and PrintFooter are AllPages, each column contains the header, footer, and some rows. When PrintHeader is FirstPage and PrintFooter is LastPage, the header is printed at the beginning of the first column and the footer is printed at the end of the last column. Other columns do not have a header and footer. When PrintHeader and PrintFooter are None, columns do not have a header or footer.

Example
The following code example shows how to use the PrintStyle.Rich style and the PagingMode.SingleRow option to print the GcMultiRow control. The ColumnHeader, Row, and ColumnFooter sections are printed in each page.The column header is printed at the beginning of the page and the column footer is printed at the end of the page. This example is part of a larger example available for the GcMultiRow.PrintSettings class.
void setRichAndSingleRowButton_Click(object sender, EventArgs e)
        {
            Template template1 = CreateTemplate(10, 100);
            AddPrintInfoCellColumnFooterSection(template1, 100);
            this.gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 5;

            //All elements are printed.
            gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich;
            //Only one Row is printed to one page. You can print ColumnHeader to each page by setting PrintHeader property to AllPages.
            gcMultiRow1.PrintSettings.PagingMode = PagingMode.SingleRow;
            //The GcMultiRow is aligned by MiddleCenter.
            gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter;
            //All Rows are printed.
            gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows;
            //In each page, besides one Row, the ColumnHeader is printed in the page's head.
            gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages;
            //In each page, besides one Row, the ColumnFooter is printed in the page's tail.
            gcMultiRow1.PrintSettings.PrintFooter = PrintFooter.AllPages;
            if (flag)
            {
                //If Template's width is greater than page's width, the excess is printed to a new page.
                gcMultiRow1.PrintSettings.HorizontalPageBreak = true;
                flag = false;
            }
            else
            {
                //If Template's width is greater than page's width, the excess is clipped.
                gcMultiRow1.PrintSettings.HorizontalPageBreak = false;
                flag = true;
            }
            gcMultiRow1.PrintSettings.AutoFitWidth = false;
            gcMultiRow1.PrintSettings.ZoomFactor = 1f;
            try
            {
                gcMultiRow1.PrintPreview();
                //If you have a printer, you can execute the following code directly instead.
                //gcMultiRow1.Print(true);
            }
            catch (Exception ex)
            {
                // Can't find printer driver.
                MessageBox.Show(ex.Message);
            }
            label.Text = "The each Row will be printed in each page with the ColumnHeader; The GcMultiRow will be aligned by MiddleCenter; Because the Template's width is greater than page's width, The HorizontalPageBreak will control whether the excess part will be printed to new page.(Click the button again to change the HorizontalPageBreak's effect)";
        }
Private Sub setRichAndSingleRowButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setRichAndSingleRowButton.Click
        Dim template1 As Template = CreateTemplate(10, 100)
        AddPrintInfoCellColumnFooterSection(template1, 100)
        Me.gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 5

        'All elements are printed.
        gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich
        'Only one Row is printed to one page. You can print ColumnHeader to each page by setting PrintHeader property to AllPages.
        gcMultiRow1.PrintSettings.PagingMode = PagingMode.SingleRow
        'The GcMultiRow is aligned by MiddleCenter.
        gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter
        'All Rows are printed.
        gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows
        'In each page, besides one Row, the ColumnHeader is printed in the page's head.
        gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages
        'In each page, besides one Row, the ColumnFooter is printed in the page's tail.
        gcMultiRow1.PrintSettings.PrintFooter = PrintFooter.AllPages

        If flag Then
            'If Template's width is greater than page's width, the excess is printed to a new page.
            gcMultiRow1.PrintSettings.HorizontalPageBreak = True
            flag = False
        Else
            'If Template's width is greater than page's width, the excess part is clipped.
            gcMultiRow1.PrintSettings.HorizontalPageBreak = False
            flag = True
        End If
        gcMultiRow1.PrintSettings.AutoFitWidth = False
        gcMultiRow1.PrintSettings.ZoomFactor = 1.0F
        Try
            'If you have a printer, you can execute the following code directly instead.
            'gcMultiRow1.Print(true);
            gcMultiRow1.PrintPreview()
        Catch ex As Exception
            ' Can't find printer driver.
            MessageBox.Show(ex.Message)
        End Try
        label.Text = "The each Row will be printed in each page with the ColumnHeader; The GcMultiRow will be aligned by MiddleCenter; Because the Template's width is greater than page's width, The HorizontalPageBreak will control whether the excess part will be printed to new page.(Click the button again to change the HorizontalPageBreak's effect)"
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PrintSettings Class
PrintSettings Members
PagingMode Property
PrintFooter Property
PrintPagesMode Property

 

 


Copyright © GrapeCity, inc. All rights reserved.