Page 1 of 1

Saving Tables In Tables

Posted: Sat May 26, 2007 1:25 pm
by DickBryant
This pertains to the same system we've been discussing where formatting is retained in a table cell by first saving to an intermediate TRVEdit that shares the TRVStyle with the TRVEdit holding the master table.

Problem is - if I copy a table in, say Microsoft Word and paste it into the RVEdit in my Editor, it comes in fine. But when I save it and reload (i.e. save Editor's RVEdit to intermediate RVEdit, thence to the master table) the pasted table isn't displayed - but something (a white rectangle with a dotted, grey, line around the inside) is.

Any hints on how to get the table properly stored within the cell of the master table? It seems to me I've read somewhere in the forums that tables within tables is supported.

TIA,

Dick

Posted: Sat May 26, 2007 1:59 pm
by Sergey Tkachenko
Please send me a simple project reproducing this problem.

Posted: Thu May 31, 2007 12:14 pm
by DickBryant
Found the problem.

The pasted table was actually being SAVED correctly. The problem was on reloading the MasterTable's cell BACK into the Editor's RVEdit. I was using the following approach in the parser (parsertable is a 1-row intermediate rvedit table that holds the processed data for the current object that is currently being worked on - the Editor's RVEdit is loaded from this structure)

with parsertable do
begin
MainText.Clear;
MainText.AppendFrom(MasterRVTable.Cells[PairNumber-1,1]);
end;

this is what was needed:

with parsertable do
begin
MainText.Clear;
Stream := TMemoryStream.Create;
try
MasterRVTable.Cells[PairNumber-1,1].SaveRVFToStream(Stream, False, clNone, nil, nil);
Stream.Position := 0;
MainText.LoadRVFFromStream(Stream,Dummy1,Dummy2,Dummy3);
FMain.RichViewEdit2.Format;
finally
Stream.Free;
end;
end;

Probably more than you wanted to know, but thought it might be helpful to someone else :-)

Posted: Thu May 31, 2007 1:13 pm
by Sergey Tkachenko
Yes, AppendFrom cannot copy tables and controls