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

Cookbook

Table - Merged cells

Start search Mail feedback Back to Description


rtTable rtCell rtTableStyle rtRow rtColumn

add (rtContainer) addNewLine (rtContainer) addNewLine (rTextParagraph) appendText (rtContainer) appendText (rTextParagraph) Add (rtCell) Add (rtCollection) Add (rTextParagraph) Borders cells (rtColumn) Cells (rtRow) Cells (rtTable) Collection (rtContainer) Collection (rtEnumeration) ColumnCount Columns ColumnSpacing getRichTextItem MergeCells MergeColumns MergeRows NextElement RowCount Rows tables Table (rtColumn) Table (rtRow) TopBorder

Code fragment from sample "Table - Merged cells"; see full running samples in downloadable help.
dim table as rtTable, c as rtCell, o as variant

Dim style as rtStyle, tableBasic as rtTableStyle, rowDisplay as rtRowDisplayStyle' these are just defined for indexer to find references to the classes/methods used

call ctxDump.getRichTextItem(doc,"Body")
' get the table, basic way
'Set coll = ctxDump.Collection (PARSE_GROUP_TABLE)' this parses and retrieves the tables
'Set table = coll.getFirstElement' we just have one table - otherwise we need to work through the collection

' alternative way I
' Set table = ctxDump.getFirst(RT_OBJ_TABLE)

' alternative way II
Set table = ctxDump.Tables.nextElement

Dim i%, j%
table.mergeCells 1,1, 2,3
ctxDump.addNewLine 1
ctxDump.appendText "MergeRows and MergeColumns properties may be used to check if there are any merged cells"

for i = 1 to table.rowCount
for j = 1 to table.columnCount
ctxDump.addNewLine 1
ctxDump.AppendText i & ":" & j & " MergeRows - " & cstr(table.cells(i,j).MergeRows) & "; MergeColumns - " & cstr(table.cells(i,j).MergeColumns)
next j
Next i

ctxDump
.addNewLine 1

set table = new rtTable(4,4)

Dim r as rtRow, col as rtColumn
set r = table.rows(4)
set col = table.columns(4)
table.ColumnSpacing = 0.4*ONE_CM

table
.mergeCells 1,2,3,3

for i = 1 to table.rowCount
for j = 1 to table.columnCount
table.cells(i,j).Content.addNewLine 1
table.cells(i,j).Content.appendText "R" &i & "xC" & j ' we merge before assigning content - the content in merged cell is not visible
table.cells(i,j).Borders = 1
if i=1 or table.cells(i,j).MergeRows>1 then table.cells(i,j).TopBorder = 10
next j
Next i

ctxDump
.addNewLine 1
ctxDump.add table
ctxDump.addNewLine 1