ComponentOne VSView 8.0
BeforeTableCell Event

Fired before a table cell is rendered, to allow custom formatting.

Syntax

Private Sub VSPrinter_BeforeTableCell( ByVal Row As Long, ByVal Col As Long, Text As String, KeepFiring As Boolean)

Remarks

The BeforeTableCell event is fired while a table is rendered, either to measure or to render each cell. 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.

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.

This event may be useful if you want to change the format of certain cells based on their contents. Note, however, that you may accomplish the same task using the TableCell property.

Also, note that this event gets called in two situations: when measuring a cell and when rendering it. This is needed so that changed in the cell format are taken into account while calculating the size of a cell. If you need to determine whether the cell is about to be measured or rendered, check the value of the Measuring property.

For example, the code below makes cells with strings longer than 100 characters bold:

Private Sub vp_BeforeTableCell(ByVal row As Long, ByVal col As Long, _

                               Text As String, KeepFiring As Boolean)

  ' we want this event to keep firing

  KeepFiring = True

 

  ' make long text bold

  vp.FontBold = ( Len(Text) > 100)

End Sub

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback