TCustomRichView.LoadDocXFromStream (D2009+ or with Delphi ZLib)

<< Click to display table of contents >>

TCustomRichView.LoadDocXFromStream (D2009+ or with Delphi ZLib)

Appends the content of DocX (Microsoft Word Document) stream Stream to the document.

function LoadRTFFromStream(Stream: TStream):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 TRichView.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 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 a DocX style sheet into Style.StyleTemplates. If TRichView was completely empty before loading, LoadDocXFromStream 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 TRichView.RTFReadProperties.DocXErrorCode)

 

See also methods of TRichView:

LoadDocX;

SaveDocXToStream.

See also events of TRichView:

OnImportPicture;

OnReadHyperlink;

OnStyleTemplatesChange;

OnProgress.

See also methods of TRichViewEdit:

InsertDocXFromStreamEd.

See also:

Saving and loading in RichView.