| MergeCells | ||||||||||||
![]() rtTable ![]() BeginInsert BorderStyle As rtBorderStyle Cells As rtCell ColumnCount Columns As rtColumn ColumnSpacing dropShadow Flags HTML HTMLStyle As rtHtmlStyle ID LayoutStyle As rtTableStyle parentParagraph Parent ParentContainer ParentObject root RowCount RowDisplayStyle As rtRowDisplayStyle Rows As rtRow RowSpacing Style TableID useBorderColor Values
| version 1.5
Function MergeCells (r1 As Integer, r2 As Integer, c1 As Integer, c2 As Integer) Cells in table may be merged as necessary using MergeCells(startRow, endRow, startColumn, endColumn) method of rtTable. Each cell may be contained in only one merged region and row and column numbers provided as arguments refer to original cells that may become invisible if merged. The table is set "Fit to margin":
MergeCells will fail in case: 1) one of columns is marked to be fixed width, i.e. in table set "fit to margin" or "fit to window" it retains constant width. "fixed width" setting is kept even in case the table itself is changed to "fixed width" type, hence before merging hasFixedWidth property of the columns involved must be set to False. 2) the table already contains a merged area and it is only partly included in new merge area. The invalid combinations will be: table.MergeCells 1,1,2,3 ' 3rd is fixed width column table.MergeCells 2,2,1,2 ' attempts to merge partially with another merged cell Successful merge will be: table.MergeCells 1,3,1,2 table.MergeCells 2,3,1,2 ' both fully include another merged region To identify merged areas in a table retrieved from item use isVisible property to find cells that are invisible (part of merged area) and isSpanning property set for the only visible cell of the merged region. Use MergeCells and MergeColumns properties of the spanning rtCell object to determine the size of the are. Use splitCells method to split merged region. It takes as an argument row and column of any cell in merged region. Following both statements will split the cells merged in table above: table.splitCells 2,2 table.splitCells 3,2 |