Back to Devexpress

Document Import and Export

vcl-405570-expressricheditcontrol-print-and-import-export-document-import-and-export.md

latest7.2 KB
Original Source

Document Import and Export

  • Jan 16, 2026
  • 3 minutes to read

TdxRichEditControl and TdxRichEditDocumentServer components allow you to import/export document content to/from a file or stream in a format of your choice: RTF, TXT, DOCX, HTML, and DOC.

Document Import and Export APIs

Both TdxRichEditControl and TdxRichEditDocumentServer components implement similar API members designed for document import and export in supported formats.

Important

Ensure that support for all required document formats is enabled; otherwise, an exception occurs. Both components include dedicated import and export settings (for each supported document format).

Refer to the following topic section for details: Enable Support for Individual Document Formats.

Rich Edit Control

TdxRichEditControl declares the following methods designed for content import and export:

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).

Document Server

TdxRichEditDocumentServer declares the following properties and methods designed for content import and export:

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.

Enable Support for Individual Document Formats

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:

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.RtfdxRichEdit.Rtf (add only for TdxRichEditDocumentServer)
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 a TdxRichEditControl or TdxRichEditDocumentServer component, expand the Add Unit to Support menu item, and add all required dependencies.

HTML Support Limitations and Considerations

TdxRichEditControl and TdxRichEditDocumentServer components have no HTML editor functionality because they do not work with HTML tags directly. HTML import routines interpret tags in a source document and build an internal document model according to the current import settings.

Important

HTML import and export routines support only a limited subset of the modern HTML standard – imported and exported documents may look different compared to corresponding source documents.

To see the Rich Edit import and export functionality in action, run the Word Processing RTF demo in the VCL Demo Center installed with compiled DevExpress demos. Click the Open or Save As button to open the corresponding dialog.

Download: Compiled VCL Demos

Tip

Compiled DevExpress demos ship with source code installed in the Public Documents folder (%Public%) for all users ( default ). You can find all project and source code files for the Rich Edit control demo in the following folder:

%Public%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressRichEditControl

See Also

Document Print and Import/Export

Document Print Functionality