Syntax
| Printer.TableCell(vsTableCellSettings[, Row1][, Col1][, Row2][, Col2]) = value
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description
| Returns or sets properties of a table cell or range.
The TableCell property is used to build and format tables. Using TableCell requires four steps:
1) Initialise a table with the TableInit method.
2) Create the table using the TableAdd method, or using the TableCell property by itself.
3) Format the table using the TableCell property.
4) Close the table definition with the TableEnd method. This will render the table.
Setting the TableCell property affects the range of cells specified by the Row1, Col1, Row2, and Col2 parameters. Getting the TableCell property retrieves properties from the cell specified by the Row1 and Col1 parameters. Some parameters apply to the whole table, others to entire rows or columns. In these cases, one or more of the range parameters are ignored.
The TableCell property is very powerful because the vsTableCellSettings parameter lets you access and modify virtually any aspect of a table. The vsTableCellSettings enumeration has over 40 values you can use. They are listed below, according to the type of formatting they provide.
The parameters for the TableCell property are described below.
VsTableCellSettings
The settings listed below are grouped in logical order, affecting the entire table to affecting one cell only:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See Also
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example
| Sub Main
Dim i As Integer
Dim r%, c%
With Printer
'Printer object activeren:
If Not .Init() Then End
'create table with 4 rows and 4 columns
.TableCell(tcCols) = 4
.TableCell(tcRows) = 4
'set some column widths (default is 0.5in)
.TableCell(tcColWidth, , 1) = "1in"
.TableCell(tcColWidth, , 2) = "1.3in"
'assign text to each cell
For r = 1 To 4
For c = 1 To 4
.TableCell(tcText, r, c) = "Row " & r & " Col " & c
Next c
Next r
'format cell (1,1): make it span two
'columns, with a blue background,
'centered alignment, and bold
.TableCell(tcColSpan, 1, 1) = 2
.TableCell(tcBackColor, 1, 1) = vbBlue
.TableCell(tcAlign, 1, 1) = taCenterMiddle
.TableCell(tcFontBold, 1, 1) = True
'set row height for row 1
'(default height calculated to fit content)
.TableCell(tcRowHeight, 1) = "0.2in"
'format cell (3,2): make is span two
'columns, with a yellow background,
'centered alignment, and bold
.TableCell(tcColSpan, 3, 2) = 2
.TableCell(tcBackColor, 3, 2) = vbYellow
.TableCell(tcAlign, 3, 2) = taCenterMiddle
.TableCell(tcFontBold, 3, 2) = True
'set row height for row 3
.TableCell(tcRowHeight, 3) = "0.2in"
'set row borders all around
.TableBorder = tbAll
'finish table definition
.Submit
End With
End Sub
![]() |