vcl-dxrichedit-dot-documentserver-dot-tdxricheditcustomdocumentserver-dot-savedocument-x28-system-dot-string-x29.md
Exports document content to a file (in any supported format).
procedure SaveDocument(const AFileName: string); overload;
| Name | Type | Description |
|---|---|---|
| AFileName | string |
An absolute or relative path to the target file.
Note
If the specified path does not include a file name extension, the procedure uses the Options.DocumentSaveOptions.DefaultFormat or Options.DocumentSaveOptions.CurrentFormat property value as the target format.
|
Call the SaveDocument procedure to export the current document to a file in any supported format.
The SaveDocument procedure uses the specified file name extension to identify the target document format. If the file name includes no extension, SaveDocument uses the default or current document format.
Support for all document formats, except for plain text, is initially disabled for the TdxRichEditDocumentServer component to avoid excessive dependencies. To enable support for 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 |
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 the 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).HtmlTextSpecifies document content as a string (in the HTML 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 | LoadDocumentTemplate | SaveDocumentExport/import document content to/from a file or stream in any supported format.
Footnotes
See Also
IdxRichEditDocument.SaveDocument Method
TdxRichEditControlBase.SaveDocument Method
Document Print and Import/Export
TdxRichEditCustomDocumentServer Class