Printer Object
 
Syntax
 
Printer.TableInit vsBorderSettings, Formatting, HeaderText
 
Description
Defers table rendering until call to EndTable.
 
The TableInit method is used to render tables. The parameters describe the table format, the contents of a header row, and the border settings. The Printer object renders the table, automatically sizing rows and breaking pages when necessary.
 
When you start a new table, using TableInit, and use several TableAdd methods and TableCell properties, between calls to TableInit and TableEnd, the table is not rendered until the call to EndTable is made.
 
This allows you to perform complex formatting on the table using the TableCell property.
 
Parameter
Description
vsTableBorderSettings 
This parameter contains the following pre-defined constants and values:
Constant
Value
Description
tbNone
0
No borders are drawn
tbBottom
1
Below the header and the table borders are drawn
tbTop
2
Above the header and the table borders are drawn
tbTopBottom
3
Above and below the header, and below the table
tbBox
4
Draws a box around the table
tbColumns
5
A vertical border between each column
tbColTopBottom
6
Above and below the header, and below the table, and between each column, borders are drawn
tbAll
7
All vertical and horizontal borders are drawn
tbBoxRows
8
A horizontal border between each row, and a box surrounding the table are drawn
tbBoxColumns
9
Above and below the header, and below the table, and a box surrounding the table are drawn
tbBelowHeader
10
A border between header and table is drawn
tbRows
11
A horizontal border between each row
 
Formatting
This parameter contains formatting information and is not printed. The formatting information describes each column using a sequence of formatting characters followed by the column width. The information for each column is delimited by the column separator character, a pipe ("|").
 
For example, the following string defines a table with four center-aligned, two-inch wide columns:
s$ = "^+2in|^+2in|^+2in|^+2in"
 
The following lists shows all valid formatting characters and their effect:
Character
Effect
<
Align column contents to the left
^
Align column contents to the center
>
Align column contents to the right
=
Justify column contents
+
Align column contents vertically to the center
_
Align column contents vertically to the bottom
*
Align column contents according to the TextAlign property
~
Prevent word wrapping on this column
!
Draw a vertical border to the right of the column (see also the TableBorder property)
Column widths may be specified in twips, inches, points, millimeters, centimeters, pixels, or as a percentage of the age width. If units are not supplied, twips are used. If a width is not supplied, 0.5 inch is used as a default value.
 
HeaderText
This parameter contains the text to be printed on the first row of the table and after each column or page break (the header row). The text for each cell in the header row is delimited by the column separator character, a pipe ("|").
 
 

 

 
Instead of supplying the table data as strings, using the TableAdd method, you may also choose to supply data for individual cells separately. To do this, use the TableCell property.
 
By default, all tables created in Basic Script, carry the Tradium standard formatting rules, which means that the table rows have individual colors (white/cyan) and a yellow header background.
 
Aligning and indenting tables:
Tables may be aligned to the left, center, or right of the page depending on the setting in the Formatting string. To indent a table by a specified amount, use the TableCell property with the tcIndent setting.
The vertical position of the table is determined by the CurrentY property.
 
Drawing borders around tables:
Tables may have borders drawn around them. To specify or alter the type and appearance of the borders, you can use the TableBorder, PenColor, PenWidth, PenStyle, TablePen, TablePenLR, and TablePenTB properties.
You may also draw vertical and horizontal borders next to specific rows and columns using the TableCell property with the tcRowBorder and tcColBorder settings.
 
Formatting individual cells:
Use the TableCell property to set the cell format, including font, back and foreground colors, alignment, etc. This technique is efficient and easy to use.
You may also use RTF text in table cells. Just enclose the cell contents in curly brackets (e.g. "{Show me \b BOLD}"), but this technique is much slower than the other alternatives.
 
Populating a table:
Instead of supplying the table data as a string, you may set the contents of individual cells using the TableCell property with the tcText setting.
 
See Also
Example