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

Quick table or data merge approach

Start search Mail feedback Back to Description

"Quick table" uses the same rtTable class as a regular table with the exception that the resulting table must be regular to certain extent and merged data can by only text strings. The whole process is pretty similar to data merge process of word processors. The table may contain header and footer area as well as it must have one or several rows defined as "template". The template rows get merged with value array.

Big tables take considerably less processing when using this approach. Smaller tables can be built using either approach. This approach may not be extended to tables containing other tables. Only Header and Footer areas may contain other than textual information appart from fixed elements (the merged text will be added before any text or objects present in cell)

1) create a regular table

Dim table as New rtTable (4, 4) ' 4 rows, 4 columns

2) define a row or several rows to be a template area. These rows are going to define the layout of data area.

table.setAsTemplate 2,2 ' 2 rows starting with 2nd are template rows; we leave one row for header and one for footer

table.mergeCells 2,2,1,3 ' we may have merged cells inside templete rows

We have defined a template area with 6 cells. You may merge cells, set margins, column width, etc.

Header row

2 rows of expandable Merge data area. Contains 6 cells. (1)






Footer row

3) add to each cell and empty text and define the font style. This font will be used by real data

' Format Cells

' we need to place text placeholders - empty text run in each cell and apply formatting
Dim r as Integer, c as Integer

For r = 1 to table.rowCount

For c = 1 to table.columnCount

Set cell = table.cells(r,c)

Set rtp = cell.addNewLine (1) ' first paragraph in cell must contain a paragraph break

cell.appendStyle fontBody

cell.appendText "" ' it may also contain any text - the new values get pre-pended to existing text

Next c

Next r

4) create a 2 dimensional array of data (strings) - 1st index - 0-based row number, 2nd index - cell in the region (in this sample 6 values per row). In case some of cells are merged, only visible cells count.

table.values = valueArray

That's it - upon writing to the item the template area will get merged with the data array. Make sure that total row count does not exceed 255.

For a full code sample see "Quicktable" in Cookbook section.