Insert Table in TCustomRVData

General TRichView support forum. Please post your questions here
Post Reply
Stefan Hempel
Posts: 2
Joined: Fri Dec 30, 2005 12:05 pm

Insert Table in TCustomRVData

Post by Stefan Hempel »

Hello

I create a TRVTableItemInfo-Object (named Table) and fill it with Cols and Rows. If i insert into a TCustomRVData-Object (named RVData) this way, all is fine :

Code: Select all

RVData->AddItem("", Table);
But I want to insert the Table at Positon CurPos, not append it at the End or in the Position of Caret.
So I tried this :

Code: Select all

TMemoryStream *Stream = new TMemoryStream();
Table->SaveToStream(Stream);
Stream->Position = 0;
TColor BkColor = clNone;
TRVBackground *Dummy1 = NULL;
TRVLayoutInfo *Dummy2 = NULL;
RVData->InsertRVFFromStream(Stream, CurrPos, BkColor, Dummy1, Dummy2, false);
delete Stream;
But this failed, nothing is inserted.
RVData->ItemCount is not increased.
Stream->Size is more than 0, so not empty.

Can you please tell me, how to correctly insert the Table at CurrPos?

thanks

/Edit : I use Builder 5 with RichView 1.9
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Table->SaveToStream() saves not exactly in RVF format.
The simplest solution is to use a hidden TRichView (linked to the same RVStyle component), add a table there, save document in Stream, then use InsertRVFToStream().
Stefan Hempel
Posts: 2
Joined: Fri Dec 30, 2005 12:05 pm

Post by Stefan Hempel »

Hello

thanks, this workaround works.
Post Reply