rvico TRichView Reference | TRichView

TCustomRichView.LoadRTF

Top  Previous  Next

Appends the content of RTF (Rich Text Format) file FileName to the document.

function LoadRTF(const FileName: String):Boolean;

(Introduced in version 1.5)

Despite its name, this method does not clear the existing document before loading. To replace the current document with the content of this file, call Clear method before loading (and may be DeleteUnusedStyles after Clear)

Method type: viewerstyle viewer-style.

Parameters for loading are in RTFReadProperties. The most important properties affecting RTF loading are RTFReadProperties.TextStyleMode and ParaStyleMode. The imported RTF may look absolutely different depending on values of these properties!  Setting for RTF loading can be changed in the TRichView component editor.

See important note on loading external images from RTF.

By default, hyperlink targets are loaded in items tags. You can customize loading using OnReadHyperlink event.

If style templates are used, and RTFReadProperties.TextStyleMode=RTFReadProperties.ParaStyleMode=rvrsAddIfNeeded, and StyleTemplateInsertMode<>rvstimIgnoreSourceStyleTemplates, the method loads an RTF style sheet into Style.StyleTemplates. If TRichView was completely empty before loading, LoadRTF replaces the existing style templates. Otherwise, it merges the RTF style sheet into the style templates, and reads text and paragraph styles according to StyleTemplateInsertMode. The method calls OnStyleTemplatesChange event.

Return value: "Was reading successful?" (extended information is in RTFReadProperties.ErrorCode)

 

unicode Unicode note: Text can be imported as Unicode or not, depending on value of RTFReadProperties.UnicodeMode.

 

See also methods of TRichView:

LoadRTFFromStream;

SaveRTF.

See also events of TRichView:

OnImportPicture;

OnReadHyperlink;

OnStyleTemplatesChange;

OnProgress;

OnAssignImageFileName.

See also methods of TRichViewEdit:

InsertRTFFromFileEd.

See also:

Saving and loading in RichView.


TRichView © trichview.com