Page 1 of 1

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

Posted: Thu Dec 21, 2006 4:37 pm
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

Posted: Fri Dec 22, 2006 12:30 pm
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.