How to unite cells?

General TRichView support forum. Please post your questions here
Post Reply
Roman2807
Posts: 7
Joined: Tue Aug 03, 2010 7:25 pm

How to unite cells?

Post by Roman2807 »

How to unite cells in the table?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1) If you want to write code yourself.
table.MergeCells (usually used before the table is inserted in the editor)
table.MergeSelectedCells (merging selected cells).
Because of merging, empty (containing only of nil-cells) rows or colums may appear, so call table.DeleteEmptyRows and table.DeleteEmptyCols after.
If the table is already inserted in the editor, you need to call these methods between rve.BeginItemModify...rve.EndItemModify, then call rve.Change.
Examples can be found in the demo Editors\Editor 1\:
- TForm1.mitInsertTable1Click, TForm1.mitInsertTable2Click insert sample tables with merged cells;
- TForm1.mitCellsOperationClick implements table operations, including cell merging.

2) If you use RichViewActions, you can use TrvActionTableMergeCells to merge selected cells, without writing any code.
Post Reply