Home > BSPrinter documentation > Reference

PrintGrid Method


Applies to: PrintPreview control , IPrinterEx object


Return Type: Boolean
Parameter(s):
In          Required          Grid          As Object
In          Optional          Style          As Variant
In          Optional          UserCanChangeStyle          As Boolean          Default value: True
In          Optional          GridPosition          As BSGridPositioningConstants          Default value: 0 - bsGACentered
In          Optional          ColsToHide          As Variant
In          Optional          PrintCellsFormatting          As BSPrintCellsFormattingConstants          Default value: 0 - bsPCFPrintAll
In          Optional          IgnoreEmptyRowsAtTheEnd          As Boolean          Default value: True


Description:

Prints the contents a grid.
Supported types are MSFlexGrid, MSHFlexGrid and compatibles.

Parameters explained:

Grid: A reference to the Grid control to be printed. This is the only parameter that is required.

Style: This optional parameter can set the Style of the Grid. It can be an object GridReportStyle, a number identifying a Style or a String with the Name of a Style.
The style can be one built-in, or one that was added by calling the Add method of the GridReportStyles collection.

UserCanChangeStyle: Determines if the user can customize the look of the printed grid by selecting another Style.
Its default value is True.

GridPosition: Determines the position of the grid if it is smaller than the page width.
Possible values are:
bsGACentered = 0
bsGALeft = 1
bsGARight = 2
bsGAStretch = 3
bsGAEnlargeLastColumn = 4
bsGACenteredAndUserCanChange = 8
bsGALeftAndUserCanChange = 9
bsGARightAndUserCanChange = 10
bsGAStretchAndUserCanChange = 11
bsGAEnlargeLastColumnAndUserCanChange = 12
The default value is bsGACentered.

ColsToHide: optional array of Boolean values that determines what columns to hide (not to print).

PrintCellsFormatting: Determines whether the cells formatting will be printed and what.
Possible values are:
bsPCFPrintAll = 0
bsPCFIgnoreForeColor = 1
bsPCFIgnoreBackColor = 2
bsPCFIgnoreFonts = 4
bsPCFIgnoreTextAlignment = 8
bsPCFIgnorePictures = 16
bsPCFIgnoreAll = 31
The default value is bsPCFPrintAll.

IgnoreEmptyRowsAtTheEnd: If there are empty rows at the end of the grid (not filled with data), it determines whether these rows will printed or not.
The default value is True (that means that the empty rows at the end will not be printed).

Return value:
When the grid has many rows, the Print Preview dialog box will show a window with the progress of loading the data and preparing the preview, and it will show a button that allows to cancel the operation. If the user clicked the button to cancel the operation, the Print Preview dialog won't be displayed and this method will return False, meaning that the operation was canceled. In a normal operation it returns True.

See Also:

PrintRichTextBox method