Copy RichView content to another RichView - Table style problem

General TRichView support forum. Please post your questions here
Post Reply
mwsta
Posts: 4
Joined: Thu Apr 03, 2025 11:32 am

Copy RichView content to another RichView - Table style problem

Post by mwsta »

I'm trying to copy the content of one richview to another one using this code:

Code: Select all

TMemoryStream *stream = new TMemoryStream();
source->SaveRTFToStream(stream, false);
stream->Position = 0;
target->LoadRTFFromStream(stream);
target->AddNL("", 0, 0, RVEMPTYTAG);
target->Format();
delete stream;
However, the tables look different in the original (source_richview.jpg) compared to the new RichView (target_richview.jpg). What am I missing? How do I need to transfer the table styles?
Attachments
source_richview.JPG
source_richview.JPG (7.54 KiB) Viewed 1910 times
target_richview.JPG
target_richview.JPG (7.62 KiB) Viewed 1910 times
mwsta
Posts: 4
Joined: Thu Apr 03, 2025 11:32 am

Re: Copy RichView content to another RichView - Table style problem

Post by mwsta »

Related to the problem above is the following: I also want to copy the content of a TRichView into a TSRichView->RichViewEdit, but it seems the styles are not copied. I tried to assign them manually using:

Code: Select all

ReportSRichViewEdit->ExternalRVStyle=my_rvstyle;
where my_rvstyle is a pointer to a TRVStyle object). That didn't work. I also tried:

Code: Select all

ReportSRichViewEdit->RichViewEdit->Style=my_rvstyle;
but it didn't work either. Clearing the styles before:

Code: Select all

ReportSRichViewEdit->RichViewEdit->Style->TextStyles->Clear(); 
ReportSRichViewEdit->RichViewEdit->Style->ParaStyles->Clear();
didn't help. What is the correct way to do this?
Sergey Tkachenko
Site Admin
Posts: 17839
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Copy RichView content to another RichView - Table style problem

Post by Sergey Tkachenko »

Not all table properties can be saved to RTF.
Use SaveRVFToStream and LoadRVFToStream.
Post Reply