rtLib — Notes Rich Text Management Library Documentation of rtLib — Notes Rich Text Management Library Download rtLib — Notes Rich Text Management Library FAQ of rtLib — Notes Rich Text Management Library Purchase rtLib — Notes Rich Text Management Library Feedback about rtLib — Notes Rich Text Management Library

Table manipulation

Regular table

Start search Mail feedback Back to Description

Table implements/gives access to practically all R5 table features. In difference from the quick table that requires some regularity in table building, the regular table allows to define cell attributes, borders, styles backgrounds in pretty arbitrary manner. The resulting tables can be used to achieve complex page layout.

The table may be either retrieved from the Rich Text item or created from scratch. Let us have a look at creation of the table from scratch. The editing of an existing table is pretty similar except you need to verify that style attributes exists and if not -- create them.

We create Tables using constructor New:

Set table = New rtTable (3, 4) ' 3 rows, 4 columns

We may append them to the correct spot in rich text hierarchy or first set the attributes and fill in the content.

ctx.addNewLine 1

ctx.add table

ctx.addNewLine 1

The table must always occupy it's own paragraph and must be followed by at least one paragraph break (the following paragraph may already contain other objects, but it must be there).

The table size we defined in constructor is not frozen. It may be changed adding, inserting or deleting rows and/or columns. It will change implicitly if we access a cell outside of currently defined table. Thus statements:

Set row = table.rows(4)

Set cell = table.cells (4,1)

table.addRow

all will result in creation of one more row. Use InsertRow to add a row inside the table and DeleteRow to delete. Same commands are available for columns.

Use Style property ( rtStyle object) to define overall apearance of the table. Column width gets defined for rtColumn object, cell borders get defined on a cell-by-cell basis.

set style = table.Style

If exists (property may also return Nothing), Style may contain one or more substyles: TableLayout ( rtTableStyle object), RowDisplay ( rtRowDisplayStyle), Border ( rtBorderStyle) and HTML ( rtHtmlStyle).

TableLayout is used to set general appearance like background color and style, fit to window/fixed, left margin (if TableLayout is Nothing it uses paragraph left margin), minimal row height, text flow,etc. RowDisplay controls how dynamic table or tabed table is displayed. Border controls external border (for cell borders use rtCell object properties) and rtHtmlStyle allows to set Class and ID parameters in table tag when generated as HTML.

With style

Set .TableLayout = new rtTableStyle (0)

.TableLayout.Color = new rtColor (COLOR_BLUE)

.TableLayout.AltColor = new rtColor (COLOR_RED) ' alternate color

.TableLayout.ColorStyle = CDTABLE_ALTERNATINGROWS

Set .RowDisplay = new rtRowDisplayStyle (0)

.RowDisplay.Viewer = CDTABLEVIEWER_TABS ' this will display table with user clickable tabs

End With

table.rows(1).TabLabel = "First label"

To sort table use Sort method of rtTable. It allows to sort table by numeric or alphanumeric values in several columns.

For more details see rtTable, rtRow, rtColumn, rtCell classes as well as styles and corresponding samples in Cookbook.

Note: Due to Notes client limitations large tables spanning several pages may print incorrectly. Watch out for the maxium number of rows = 255.