Clone a table from one TRichView to another

General TRichView support forum. Please post your questions here
Post Reply
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Clone a table from one TRichView to another

Post by wolf1860 »

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!
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Clone a table from one TRichView to another

Post by Sergey Tkachenko »

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.

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;

wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: Clone a table from one TRichView to another

Post by wolf1860 »

Thank u!
Post Reply