Printer Object
 
Syntax
 
Printer.AddTable Format, Header, Body [,HeaderShade][,BodyShade][,Append]
 
Description
Renders a table with row headers and special formatting.
 
The AddTable method is used to render tables. The parameters describe the table format, the contents of a header row, and the contents of the table body. The Printer object renders the table, automatically sizing rows and breaking pages when necessary.
 
Parameter
Description
Format
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 (|).
For example, the following string defines a table with four center-aligned, two-inch and 40 millimeter wide columns:
s$ = "^+2in|^+40mm|^+2in|^+40mm"
The following lists shows all valid formatting characters and their effect:
 
Char
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 Align method
~
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.
Header 
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 (|).
If you are appending to an existing table and would like the header to appear at the breaks but not in the beginning of the table, set the Append parameter to True.
Body 
This parameter contains the text for the table body. Cells are delimited by column separator characters, and rows are delimited by row separator characters. Cells are separated by pipes (|) and rows by semi-colons (;).
You may also choose to supply data for individual cells separately. To do this, use the TableCell property.
Headershade
This optional parameter specify colors to be used for shading the cells in the header of the table. If omitted or set to zero, the cells are not shaded. If you want to use black shading, do not use zero or the vbBlack constant. Use a very dark shade of gray instead (e.g. 1 or RGB(1,1,1)).
Bodyshade
This optional parameter specify colors to be used for shading the cells in the body of the table. If omitted or set to zero, the cells are not shaded. If you want to use black shading, do not use zero or the vbBlack constant. Use a very dark shade of gray instead (e.g. 1 or RGB(1,1,1)).
Append
Set this optional parameter to True if you want the Header string to appear at the top of each page, but not in the beginning of the table. This is useful if you are printing a table in parts, using several calls to the AddTable method, and dont want headers to be included between table sections.
See Also
Example
 
Sub Main
Dim Head As String
Dim Body As String
 
With Printer
   'Printer object activeren:
   If Not.Init() Then End
 
   'tekst sturen naar de printer
   .Paragraph "Rapportage"
 
   'Koptekst opmaken
   Head = "Maand|Jaar|Bedrag"
  
   'Inhoud van de tabel opmaken
   Body = "01|02|1345,00;02|02|1445,40;"
 
   'plaatsen in het document
   .AddTable "25%|25%|50%", Head, Body
 
   'afdrukken gereed, object afsluiten
   .Submit
 
End With
 
End Sub