I have 2 TRichViews,the first has a TRVTableItem with merged cells,TButton/TMemo controls in some cells,Now ,I want to (1)Move (2) Clone the TRVTableItem to the second TRichView,How to do?
Thanks a lot!
Clone a table from one TRichView to another
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Clone a table from one TRichView to another
The simplest way is selecting the table, saving selection to RVF, and then insert RVF to another editor.
Let ItemNo is the item index of the table in rve1, and you want to insert a copy of this table in the position of caret in rve2.
Let ItemNo is the item index of the table in rve1, and you want to insert a copy of this table in the position of caret in rve2.
Code: Select all
var
Stream: TMemoryStream;
rve1.SetSelectionBounds(ItemNo, 0, ItemNo, 1);
Stream := TMemoryStream.Create;
try
rve1.SaveRVFToStream(Stream, True);
Stream.Position := 0;
rve2.InsertRVFFromStreamEd(Stream);
finally
Stream.Free;
end;