vcl-dxrichedit-dot-nativeapi-dot-idxricheditdocument-dot-loaddocument-x28-system-dot-classes-dot-tstream-dxrichedit-dot-nativeapi-dot-tdxricheditdocumentformat-system-dot-string-x29.md
Imports a document from a specified stream (in any supported format).
procedure LoadDocument(AStream: TStream; AFormat: TdxRichEditDocumentFormat; const ASourceUri: string); overload;
| Name | Type | Description |
|---|---|---|
| AStream | TStream |
The source stream.
| | AFormat | TdxRichEditDocumentFormat |
The source document format.
| | ASourceUri | string |
A path to external document content.
|
Call the LoadDocument procedure to import a document from a stream in any supported format. Imported content replaces the current document.
A successful LoadDocument call updates Options.DocumentSaveOptions.CurrentFileName and Options.DocumentSaveOptions.CurrentFormat property values for the parent TdxRichEditControl or TdxRichEditDocumentServer component.
Use the AFormat parameter to specify the source document format.
If you pass TdxRichEditDocumentFormat.Undefined as the AFormat parameter, the LoadDocument procedure iterates through all supported formats to identify the best possible match for the source document.
DevExpress Rich Text components initially support a limited number of document formats to avoid excessive dependencies:
TdxRichEditControlHas predefined support only for TXT and RTF.TdxRichEditDocumentServerHas predefined support only for TXT.
To enable support for all available formats, add all required dependencies at design time or in code:
| Extension | Document Format | Format Value | Import/Export Settings | Support / Required Dependencies |
|---|---|---|---|---|
TXT/txt | Plain Text | PlainText | Options.Import.PlainText/Options.Export.PlainText | Built-in Support |
RTF/rtf | Rich Text Format | Rtf | Options.Import.Rtf/Options.Export.Rtf | dxRichEdit.Rtf (add only for TdxRichEditDocumentServer) |
DOC/doc | Microsoft Word® 97 – 2003 | Doc | Options.Import.Doc/Options.Export.Doc | dxRichEdit.Doc |
HTML/html | Hypertext Markup Language | Html | Options.Import.Html/Options.Export.Html | dxRichEdit.Html |
DOCX/docx | Office OpenXML | OpenXml | Options.Import.OpenXml/Options.Export.OpenXml | dxRichEdit.OpenXML |
At design time, you can right-click a TdxRichEditControl or TdxRichEditDocumentServer component, expand the Add Unit to Support menu item, and add all required dependencies.
You can also use the following API members to import/export document content in different supported[1] formats:
DocBytesSpecifies document content as a byte array (in the Microsoft Word® 97 – 2003 binary format).OpenXmlBytesSpecifies document content as a byte array (in the Office OpenXML format).RtfTextSpecifies document content (as an RTF string).TextSpecifies document content (as a plain text string).LoadDocument | SaveDocumentExport/import document content to/from file or stream in any supported format.
Footnotes
See Also
TdxRichEditControlBase.LoadDocument Method
TdxRichEditCustomDocumentServer.LoadDocument Method