Back to Devexpress

TdxRichEditControlBase.SaveDocument(string) Method

vcl-dxrichedit-dot-control-dot-core-dot-tdxricheditcontrolbase-dot-savedocument-x28-system-dot-string-x29.md

latest5.7 KB
Original Source

TdxRichEditControlBase.SaveDocument(string) Method

Exports document content to a file (in any supported format).

Declaration

delphi
procedure SaveDocument(const AFileName: string); overload;

Parameters

NameTypeDescription
AFileNamestring

An absolute or relative path to the target file.

|

Remarks

Call the SaveDocument procedure to export the current document to a file in any supported format.

Available Export Formats

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.

Export Format Support

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:

ExtensionDocument FormatFormat ValueImport/Export SettingsSupport / Required Dependencies
TXT/txtPlain TextPlainTextOptions.Import.PlainText/Options.Export.PlainTextBuilt-in Support
RTF/rtfRich Text FormatRtfOptions.Import.Rtf/Options.Export.RtfBuilt-in Support
DOC/docMicrosoft Word® 97 – 2003DocOptions.Import.Doc/Options.Export.DocdxRichEdit.Doc
HTML/htmlHypertext Markup LanguageHtmlOptions.Import.Html/Options.Export.HtmldxRichEdit.Html
DOCX/docxOffice OpenXMLOpenXmlOptions.Import.OpenXml/Options.Export.OpenXmldxRichEdit.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

Other Document Import/Export Options

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

  1. Ensure that support for all required document formats is enabled; otherwise, an exception occurs.
    Refer to corresponding API member descriptions for detailed information on support for different document formats.

See Also

IdxRichEditDocument.SaveDocument Method

TdxRichEditCustomDocumentServer.SaveDocument Method

Document Print and Import/Export

TdxRichEditControlBase Class

TdxRichEditControlBase Members

dxRichEdit.Control.Core Unit