Saving text-style information in RTF files (OnSaveRTFExtra)?

General TRichView support forum. Please post your questions here
Post Reply
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Saving text-style information in RTF files (OnSaveRTFExtra)?

Post by Crowbar »

Hi,
i saving additional information in RTF files with the OnSaveRTFExtra event.
I save my footer with following code:

Code: Select all

Procedure TForm.MainRichViewEditSaveRTFExtra(Sender: TCustomRichView; Area: TRVRTFSaveArea; Obj: TObject; Index1, Index2: Integer; InStyleSheet: Boolean; var RTFCode: string);

Var
 strFooter : String;

begin
  FooterRichViewEdit.SelectAll;
  strFooter:=FooterRichViewEdit.GetSelTextW;
  FooterRichViewEdit.Deselect;
  case Area of
    rv_rtfs_Doc : RTFCode:='{\footer\pard\plain\posxc '+strFooter+'\par}';
    rv_rtfs_TextStyle : ; // Here ???                    
  end;
end;
How do I save text-styles for the footer? So that the same text-styles of the footer in the RTF file is saved?
The footer becomes in "MS Word" displayed to example in "Arial 12" instead "Tahoma 7".

Is that difficult? :roll:

Regards
Crowbar
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

rv_rtfs_TextStyle allows saving additional properties for text style. It does not allow applying text styles to text fragment.

I am afraid it's not possible.
It's simple to define font size. For 12pt, add \fs24 after \plain.
But defining font name requires index in RTF font table. This table is not available from this event.
Post Reply