Page 1 of 1

merge table rows

Posted: Thu May 09, 2019 1:02 pm
by vector
Hello!

I have a rtf document opened in richchedit, with two tables.
How can i insert the second table 3. row into first table 9. row?
Please help me. The structure of the tables is unknow, because it made by user.

Thank you!

Re: merge table rows

Posted: Fri May 10, 2019 10:34 am
by Sergey Tkachenko

Code: Select all

var
  Stream: TMemoryStream;

  Stream := TMemoryStream.Create;
  table2.SaveRowsToStream(Stream, 9, 1);
  Stream.Position := 0;
  table2.LoadFromStreamEx(3, 0, False);
  Stream.Free;
  RichView1.Format;
This code works if tables are in the same editor.
If rows are incompatible, LoadFromStreamEx raises an exception.