|
Grids printing
All grids print jobs are derived form the abstract TGridPrintJob component. This component supports the grid drawing with the header and footer and all derived components just override the DrawCell and GetColWidth abstract methods. The print job component passes the column and row index into these methods and there are sme special values of the index defined in the PJGrid unit.
const
rowHeader = -MaxInt; // header row
rowFooter = MaxInt; // footer row
colIndex = -1; // index column
The index column is supported in all grid print jobs. When the IndexColumn property is True the index column is displayed at the left side of the printed grid. The header cell of this column contains the "#" symbol and all other rows has row number.
The font for header, footer and page area can be chosen by the HeaderFont, FooterFont and PageFont properties.
All grid print jobs allow to show/hide the borders around a cell and around the entire table on the page. The FooterCellBorders, HeaderCellBorders and PageCellBorders properties control the border around the cells of header, footer and page areas, and the TableBorders property controls the border around the entire table on each page. The type of these properties is TCellBorders defined in the PJGrid unit.
type
TCellBorder = (cbTop,cbLeft,cbRight,cbBottom);
TCellBorders = set of TCellBorder;
For instance, if you want to print the page with two lines - after header and before footer, just set PageCellBorders and TableCellBorders to [], HeaderCellBorders to [cbBottom] and FooterCellBorders to [cbTop].
Other important properties of the grid print job components are ColCount, RowCount and RowsPerPage properties. Some components don't publish the RowCount property and calculate it internally (for example, TListViewPrintJob sets the RowCount to the linked TListView's Items.Count).
The following grid print job components are available in Print Suite:
- TSimpleGridPrintJob
- This print job allows to print any graphic content in the cells using OnColWidth event when the user can set the width of each column and OnDraw when the graphic content can be drawn.
- TSimpleTextGridPrintJob
- This component is derived from TCustomSimpleGridPrintJob and allows to print the text grids. The new OnCellAlign and OnCellText events are defined. The Multiline property allow to draw the multiline text in the cell.
- TDBGridPrintJob, TStringGridPrintJob, TListViewPrintJob
- These are text grid components those allow to print the database, string grid and list view contents in the grid mode. All you need to use this component is linking it with the appropriate component using the appropriate property and set the RowsPerPage property.
|