TCustomRichView.LoadDocX (D2009+)

<< Click to display table of contents >>

TCustomRichView.LoadDocX (D2009+)

Appends the content of DocX (Microsoft Word Document) file FileName to the document.

function LoadDocX(const FileName: TRVUnicodeString):Boolean;

(Introduced in version 19)

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 maybe DeleteUnusedStyles after Clear)

Method type: viewerstyle viewer-style.

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

See important note on loading external images from DocX.

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 a DocX style sheet into Style.StyleTemplates. If TRichView was completely empty before loading, LoadDocX replaces the existing style templates. Otherwise, it merges the DocX 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.DocXErrorCode)

 

See also methods of TRichView:

LoadDocXFromStream;

SaveDocX.

See also events of TRichView:

OnImportPicture;

OnReadHyperlink;

OnStyleTemplatesChange;

OnProgress;

OnAssignImageFileName.

See also methods of TRichViewEdit:

InsertRTFFromFileEd.

See also:

Saving and loading in RichView.