Page 1 of 1

Clone a table from one TRichView to another

Posted: Mon Aug 20, 2018 11:44 pm
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!

Re: Clone a table from one TRichView to another

Posted: Tue Aug 21, 2018 3:31 pm
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;


Re: Clone a table from one TRichView to another

Posted: Tue Aug 21, 2018 3:43 pm
by wolf1860
Thank u!