IdxRichEditDocument.SaveDocument(TStream,TdxRichEditDocumentFormat) Method
Exports document content to a stream (in any supported format).
Declaration
procedure SaveDocument(AStream: TStream; AFormat: TdxRichEditDocumentFormat); overload;
Parameters
Name | Type | Description |
---|---|---|
AStream | TStream | The target stream. |
AFormat | TdxRichEditDocumentFormat | The target document format. |
Remarks
Call the SaveDocument
procedure to export the current document to a stream in any supported format.
Available Export Formats
The SaveDocument
procedure accepts the required export format as the AFormat
parameter. If you pass TdxRichEditDocumentFormat.Undefined as the parameter, the parent component’s Options.DocumentSaveOptions.DefaultFormat or Options.DocumentSaveOptions.CurrentFormat property defines the target document format.
Export Format Support
DevExpress Rich Text components initially support a limited number of document formats to avoid excessive dependencies:
- TdxRichEditControl
- Has predefined support only for TXT and RTF.
- TdxRichEditDocumentServer
- Has 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.
Other Import/Export Options
You can also use the following API members to import/export document content in different supported[1] formats:
- DocBytes
- Specifies document content as a byte array (in the Microsoft Word® 97 – 2003 binary format).
- OpenXmlBytes
- Specifies document content as a byte array (in the Office OpenXML format).
- RtfText
- Specifies document content (as an RTF string).
- Text
- Specifies document content (as a plain text string).
- LoadDocument | SaveDocument
- Export/import document content to/from file or stream in any supported format.