Saving Tables In Tables

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Saving Tables In Tables

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

Post by Sergey Tkachenko »

Please send me a simple project reproducing this problem.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

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

Post by Sergey Tkachenko »

Yes, AppendFrom cannot copy tables and controls
Post Reply