Page 1 of 1

Copy RichView content to another RichView - Table style problem

Posted: Tue May 27, 2025 1:47 pm
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?

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

Posted: Wed May 28, 2025 12:04 am
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?

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

Posted: Wed May 28, 2025 11:26 am
by Sergey Tkachenko
Not all table properties can be saved to RTF.
Use SaveRVFToStream and LoadRVFToStream.