vcl-dxrichedit-dot-control-dot-core-dot-tdxricheditcontrolbase-dot-savedocument-x28-system-dot-string-dxrichedit-dot-nativeapi-dot-tdxricheditdocumentformat-x29.md
Exports document content to a file (in any supported format).
procedure SaveDocument(const AFileName: string; ADocumentFormat: TdxRichEditDocumentFormat); overload;
| Name | Type | Description |
|---|---|---|
| AFileName | string |
An absolute or relative path to the target file.
| | ADocumentFormat | TdxRichEditDocumentFormat |
The target document format.
|
Call the SaveDocument procedure to export the current document to a file in any supported format.
The SaveDocument procedure accepts the required export format as the ADocumentFormat parameter. If you pass TdxRichEditDocumentFormat.Undefined as the parameter, the Options.DocumentSaveOptions.DefaultFormat or Options.DocumentSaveOptions.CurrentFormat property defines the target document format for a new or existing file, respectively.
Support for all document formats, except for TXT and RTF, is initially disabled for the TdxRichEditControl 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 | Built-in Support |
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 TdxRichEditControl component, expand the Add Unit to Support menu item, and add all required dependencies.
The TdxRichEditControl component ships with the following action classes you can use to add Save and Save As end-user commands in your application:
TdxRichEditControlSaveDocumentA SaveDocument command’s action object.TdxRichEditControlSaveDocumentAsA SaveDocumentAs command action object.
Tip
You can use automatic UI generation to create a Ribbon or toolbar UI populated with all predefined end-user commands available for TdxRichEditControl as demonstrated in the following topic:
How to Create a Ribbon or Toolbar UI for your Rich Edit-based Application
You can also use the following API members to import/export document content in different supported[1] formats:
LoadDocumentImports document content from a file or stream (in any supported format).LoadDocumentTemplateImports a document as a template from a file or stream (in any supported format).SaveDocumentExports document content to a file or stream (in any supported format).
Footnotes
See Also
IdxRichEditDocument.SaveDocument Method
TdxRichEditCustomDocumentServer.SaveDocument Method
Document Print and Import/Export