Top  Previous  Next

Occurs when the application needs to save or load a file in a custom format.


  TRVAFileOperation = (rvafoOpen, rvafoSave, rvafoExport, rvafoInsert);

  TRVCustomFileOperationEvent = procedure (Sender: TrvAction; Edit: TCustomRichViewEdit;

    const FileName: String; Operation: TRVAFileOperation;

    var SaveFormat: TrvFileSaveFilter;

    var CustomFilterIndex: Integer; var Success: Boolean) of object;


property OnCustomFileOperation: TRVCustomFileOperationEvent;

This event occurs when the following actions are executed:

TrvActionOpen (Operation=rvafoOpen)

TrvActionSave (Operation=rvafoSave)

TrvActionExport (Operation=rvafoExport)

TrvActionInsertFile (Operation=rvafoInsertFile)

FileName is a file name (full path) for opening/saving.

CustomFilterIndex is an index of custom format (in the CustomFilter property of the corresponding action), from 1.

For an opening operation, you can define a saving format in SaveFormat parameter (this format will be used for subsequent saving of document loaded from this file); you can also change CustomFilterIndex (on input, it corresponds to TrvActionOpen.CustomFilter; on output, it must correspond to TrvActionSaveAs.CustomFilter, if SaveFormat=ffeCustom). For all other operations, SaveFormat and output value of CustomFilterIndex are ignored.

Set Success to True if you loaded/saved file successfully.

See also:


You can use LoadCSV function to implement an insertion of CSV files.


By default, RichViewActions allows opening and saving HTML files only with rvHtmlViewImporter.

This example allows using rvHtmlImporter for this. Use it at your own risk, because a quality of rvHtmlImporter is not guaranteed.

First, assign CustomFilter property of TrvActionOpen and TrvActionSaveAs. You can do it at design time in the Object Inspector. But if you want to make it localizable, do it at run time in

the localization procedure (in the ActionTest project, do it in the procedure TForm3.Localize):

  rvActionsResource.rvActionOpen1.CustomFilter :=  RVA_GetS(rvam_flt_HTMLOpen);

  rvActionsResource.rvActionSaveAs1.CustomFilter :=  RVA_GetS(rvam_flt_HTMLOpen);

Make sure that ffiCustom is in TrvActionOpen.Filter, and ffeCustom is in TrvActionSaveAs.Filter.

Next, process RVAContolPanel.OnCustomFileOperation event:

procedure TForm3.RVAControlPanel1CustomFileOperation(Sender: TrvAction;

  Edit: TCustomRichViewEdit; const FileName: String;

  Operation: TRVAFileOperation; var SaveFormat: TrvFileSaveFilter;

  var CustomFilterIndex: Integer; var Success: Boolean);

var Stream: TFileStream;

    s: TRVRawByteString;


  case Operation of




          // This example assumes that there is only one custom open format,

          // so it does not check CustomFilterIndex (it must be 1)

          Stream := TFileStream.Create(FileName, fmOpenRead);


            SetLength(s, Stream.Size);

            Stream.ReadBuffer(PRVAnsiChar(s)^, Length(s));




          RvHtmlImporter1.RichView := Edit;


          // This example assumes that there is only one custom save format,

          // so it does not assign CustomFilterIndex and SaveFormat

          // (they are already 1 and ffeCustom correspondingly)

          Success := True;


          Success := False;





          // This example assumes that there is only one custom save format,

          // so it does not check CustomFilterIndex (it must be 1)      

          Success := Edit.SaveHTML(FileName, rvActionsResource.rvActionExport1.FileTitle,






RichViewActions ©