TCustomRichView.OnSaveRTFExtra

<< Click to display table of contents >>

TCustomRichView.OnSaveRTFExtra

Allows saving additional information in RTF

type

  TRVRTFSaveArea = // defined in RVStyle.pas

    (rv_rtfs_TextStyle, rv_rtfs_ParaStyle, rv_rtfs_ListStyle, 

    rv_rtfs_StyleTemplate, rv_rtfs_StyleTemplateText, 

    rv_rtfs_CellProps, rv_rtfs_RowProps, rv_rtfs_Doc);

 TRVSaveRTFExtraEvent = procedure (Sender: TCustomRichView;

   Area: TRVRTFSaveArea; Obj: TObject;

   Index1, Index2: Integer;

   InStyleSheet: Boolean; var RTFCode: TRVUnicodeStringof object;

 

property OnSaveRTFExtra: TRVSaveRTFExtraEvent;

(changed in version 18)

This event occurs when saving RTF (SaveRTF, SaveRTFToStream).

Text assigned to RTFCode parameter will be saved in RTF (converted to ANSI)

Area defines a place where RTFCode will be inserted. Meaning of Index1, Index2 and Obj depends on Area.

Area

Meaning

rv_rtfs_TextStyle

Occurs when saving text style.
Index1 is an index of the text style in TextStyles collection, Obj is a text style object

If InStyleSheet=True, this style is saved as a part of style sheet (when RTF is saved with rvrtfSaveStyleSheet option)

rv_rtfs_ParaStyle

Occurs when saving paragraph style.
Index1 is an index of the paragraph style in ParaStyles collection, Obj is a paragraph style object

If InStyleSheet=True, this style is saved as a part of style sheet (when RTF is saved with rvrtfSaveStyleSheet option)

rv_rtfs_ListStyle

Occurs when saving list style and list levels.
Index1 is an index of the list style in ListStyles.
Index2 equals to -1 when saving the list description, or  it equals to the level index when saving list level.
Obj is a list style object

rv_rtfs_StyleTemplate

Occurs when saving a style template as a style sheet item.

Index1 is an index of the style template in StyleTemplates.

Index2 = -1

Obj is a style template.

rv_rtfs_StyleTemplateText

Occurs when saving a style template as an additional style sheet item (containing only character properties), linked the the main style sheet item. Such additional style sheet items are created for style templates having Kind = rvstkParaText.

Index1 is an index of the style template in StyleTemplates.

Index2 = -1

Obj is a style template.

rv_rtfs_CellProps

Occurs when saving table cell properties.
Index1 = row index, Index2 =column index, Obj is the table.

rv_rtfs_RowProps

Occurs when saving table row properties.
Index1 = row index, Obj is the table.

rv_rtfs_Doc

Allows saving additional information at the beginning of the document

Example

procedure TMyForm.MyRichViewSaveRTFExtra(

  Sender: TCustomRichView; Area: TRVRTFSaveArea;

  Obj: TObject; Index1, Index2: Integer;

  InStyleSheet: Boolean; var RTFCode: TRVAnsiString);

begin

  if Area=rv_rtfs_Doc then

    RTFCode := '\paperw11906\paperh16838\margl567\'+

      'margr567\margt567\margb567';

end;

This example saves paper size = A4, and margins = 1 cm.

See also properties:

DocParameters.

See also events:

OnSaveDocXExtra;

OnSaveHTMLExtra.

See also examples:

https://www.trichview.com/forums/viewtopic.php?t=64.