<< Click to display table of contents >>


Allows you to change how document items are saved in text, RTF, DocX or HTML file or stream.


  TRVSaveItemToFileEvent = procedure (Sender: TCustomRichView;

    const Path: String; RVData: TCustomRVData; ItemNo: Integer;

    SaveFormat: TRVSaveFormatvar OutStr:TRVUnicodeString;

    var DoDefault: Boolean) of object;

(introduced  in v1.8; changed in v18)

This is a "low level" event allowing to change saving of items completely.

There are events offering a subset of functionality of this event:




These events are easier to use than this event.


Input parameters:

Path path to output file;

RVData, ItemNo item to save. RVData document containing item that is being saved; it can be Sender.RVData, table cell, or RVData of cell inplace-editor. ItemNo index of this item inside RVData.

SaveFormat identifies file format, one of rvsfText, rvsfHTML, rvsfRTF, rvsfDocX.


for non-text items: empty string;

for text items: text that needs to be saved (it can be a part of the item's text when saving selected fragment).

DoDefault True.


Output parameters:

Set values of DoDefault and OutStr according to the table below.

Output value of DoDefault

For Unicode text items

For non-text items


For text files: default saving, value of OutStr is ignored.

For HTML, RTF, DocX: value of OutStr will be processed afterward (for example, '<' will be  changed to '&lt;' for HTML).

Default saving, value of OutStr is ignored.


OutStr will be inserted in the file without further processing (no control codes will be replaced).

If you do not want to change saving of some item, leave DoDefault to True.

You cannot override some special processing for paragraph markers when saving to HTML and RTF.

Notes about DocX:

this event is not called for tables

this event allows changing saving of numbering sequences only partially


Example: saving pictures as '[PIC]'

procedure TMyForm.MyRichViewSaveItemToFile(

  Sender: TCustomRichView; const Path: String;

  RVData: TCustomRVData; ItemNo: Integer;

  SaveFormat: TRVSaveFormat; 

  var OutStr: TRVUnicodeStringvar DoDefault: Boolean);


  if (RVData.GetItemStyle(ItemNo)=rvsPicturethen


    OutStr := '[PIC]';

    DoDefault := False;