Control Reference > VSPrinter Control > VSPrinter Events > AfterTableCell Event |
Fired after a table cell is rendered, to allow custom painting.
Private Sub VSPrinter_AfterTableCell(ByVal Row As Long, ByVal Col As Long, ByVal Left As Double, ByVal Top As Double, ByVal Right As Double, ByVal Bottom As Double, Text As String, KeepFiring As Boolean)
The AfterTableCell event is fired while a table is rendered. Its parameters are described below:
Row, Col As Long
These parameters identify the cell that was printed. The coordinates are 1-based, except for header rows which have index zero. For example, cell (0,1) is the first cell on the header row. Cell(1,1) is the first cell in the table body.
Left, Top, Right, Bottom As Double
These parameters specify the cell rectangle on the page, in twips.
Text As String
This parameter contains the string that was printed on the cell.
KeepFiring As Boolean
This parameter should be set to True by the event handler. The default value, False, indicates that the event is not needed and thus should no longer be fired. Not firing the events makes table rendering more efficient.
For example, the code below draws a cross over cells that contain strings longer than 100 characters:
Private Sub vp_AfterTableCell(ByVal row As Long, ByVal col As Long, _
ByVal Left As Double, ByVal Top As Double, _
ByVal Right As Double, ByVal Bottom As Double, _
Text As String, KeepFiring As Boolean)
' we want this event to keep firing
KeepFiring = True
' draw cross if we have to
If Len(Text) > 100 Then
vp.DrawLine Left, Top, Right, Bottom
vp.DrawLine Left, Bottom, Right, Top
End If
End Sub