LoadRTF deletes the header

General TRichView support forum. Please post your questions here
Post Reply
starhu
Posts: 49
Joined: Fri Jan 17, 2014 6:33 pm

LoadRTF deletes the header

Post by starhu »

Hello,

I use this:
SRichViewEdit1.RichViewEdit.LoadRTF( 'e:\MyRtf.rtf');

SRichViewEdit1.RichViewEdit.Format;

The big problem is that this deletes the whole header (picture and text all).

How can I avoid this?

Thank you very much!
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, SRichViewEdit1.RichViewEdit.LoadRTF replaces existing header to header from RTF.
Workaround:

Code: Select all

SRichViewEdit1.RichViewEdit.RTFReadProperties.SetHeader(nil);
SRichViewEdit1.RichViewEdit.RTFReadProperties.SetFooter(nil);
To restore normal settings, call

Code: Select all

SRichViewEdit1.RichViewEdit.RTFReadProperties.SetHeader(SRichViewEdit1.RVHeader.RVData);
SRichViewEdit1.RichViewEdit.RTFReadProperties.SetFooter(SRichViewEdit1.RVFooter.RVData);
starhu
Posts: 49
Joined: Fri Jan 17, 2014 6:33 pm

Post by starhu »

Thank you for your help!
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please note that we plan to change headers and footers in ScaleRichView in the next update.

Currently, there is only one header and one footer, they are stored and displayed in RVHeader and RVFooter.

In the next update, TSRichViewEdit will have 6 of them:
(header, footer) * (first page, even pages, odd pages).
Using 6 editors is not rational, so headers and footers will be stored in separate properties, and loaded to RVHeader and RVFooter only for editing (similarly, like notes are loaded to RVNote).
So the code for restoring normal settings will be different.
Post Reply