Can I add rows and columns in a table without reformat.
Now I use aTable.InsertCols and without aEditor.reformat I can't use the new column. The seem probleem by adding a row.
I want to reformat my editor at the end of my procedure.
add rows and columns in table without reformatting
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
It's not necessary to reformat the whole document, but the table must be reformatted. It can be done by BeginItemModify & EndItemModify methods.
Copied from Demos\Delphi\Editors\Editor 1\
Copied from Demos\Delphi\Editors\Editor 1\
Code: Select all
var item: TCustomRVItemInfo;
table: TRVTableItemInfo;
Data: Integer;
rve: TCustomRichViewEdit;
ItemNo: Integer;
begin
if not RichViewEdit1.CanChange or
not RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve, item) then
exit;
table := TRVTableItemInfo(item);
ItemNo := rve.GetItemNo(table);
rve.BeginItemModify(ItemNo, Data);
case Operation of
1:
table.InsertRowsAbove(1);
2:
table.InsertRowsBelow(1);
3:
table.InsertColsLeft(1);
4:
table.InsertColsRight(1);
end;
rve.EndItemModify(ItemNo, Data);
rve.Change;
end;