TrvActionOpen.LoadFile

<< Click to display table of contents >>

TrvActionOpen.LoadFile

Loads the specified file in rve.

procedure LoadFile(rve: TCustomRichViewEdit;

  const FileName: TRVUnicodeString; 

  FileFormat: TrvFileOpenFilter; CustomFilterIndex: Integer=0);

Parameters:

rve – editor where to load file.

FileName – name of the file to load.

FileFormat – format of this file.

CustomFilterIndex used only if FileFormat is ffiCustom.

If FileFormat = ffiCustom, CustomFilterIndex identifies a custom file format. Custom formats are numbered from 1 in the order they are listed in the CustomFilter property.

This procedure performs the following tasks:

1.Clears the document (calls TCustomRichViewEdit.Clear); clears the background image; if rvfoSaveDocProperties is included in TCustomRichViewEdit.RVFOptions, clears its DocProperties and resets DocParameters properties*

2.Applies the default values specified in the properties of GetControlPanel: DefaultColor, DefaultMargin*

3.Calls OnNew event*

4.If FileFormat = ffiTextANSI, and the linked ControlPanel's UseTextCodePageDialog = True, shows a dialog for choosing the text code page.

5.Loads the file in rve.

6.Associates rve with this file and file format (in the list of documents maintained by TrvActionSave).

7.Calls OnDocumentFileChange event of the linked (implicitly or explicitly) TrvActionSave action.

8.Calls OnMarginsChanged event of GetControlPanel component.

9.Formats the document (calls TCustomRichViewEdit.Format).

10.If GetControlPanel.AutoDeleteUnusedStyles=True, deletes unused styles (calls TCustomRichViewEdit.DeleteUnusedStyles(True, True, True)).

11.Calls OnOpenFile event.

Subsequent executions of TrvActionSave will save rve content in this file in this format.

 

* If TrvActionNew is linked (either implicitly or explicitly), its functions for document clearing and resetting are used; they do the same, but also apply TrvActionNew.StyleTemplates.