TdxRichEditCustomDocumentServer.RtfText Property
Specifies document content (as an RTF string).
Declaration
property RtfText: string read; write;
Property Value
Type | Description |
---|---|
string | Document content (as an RTF string). |
Remarks
You can use the RtfText
property to import/export document content in the RTF format (ensure that support for the Rich Text Format (RTF) is enabled).
Internal Document Model and Import/Export Operations
Important
The TdxRichEditDocumentServer component does not work natively with documents in the RTF format. Instead, the component builds a document model in memory using an internal XML-like format. You can edit the current document directly using API members accessible through the Document property.
The RtfText
property value’s read/write operations export/import document content. You can use the following properties to configure RTF export/import settings:
- Options.Export.Rtf
- Provides access to settings applied to exporting a document to the RTF file format.
- Options.Import.Rtf
- Provides access to settings applied to importing rich text (RTF) documents into the Rich Edit control.
Enable Support for RTF Format
Support for the rich text format is initially disabled for the TdxRichEditDocumentServer component to avoid excessive dependencies.
Note
If support for the target format of an import/export operation is disabled, an exception occurs.
To enable support for the RTF format in your application, expand the Add Unit to Support menu item, and add all required dependencies at design time or in code.
At Design Time
Right-click a TdxRichEditDocumentServer component, check the Rich Text Format (RTF) option, and save your project to add all required dependencies automatically.
In Delphi Code
Add the dxRichEit.Rtf
unit to the uses clause of the same unit where the TdxRichEditDocumentServer component is placed. If you build the project with runtime packages, add dxRichEditControlRtfFormatRS~
to the list of runtime packages.
In C++Builder Code
Add the following directives to the same source files where the TdxRichEditDocumentServer component is placed:
#include "dxRichEdit.Rtf.hpp"
(to the target HPP file)#pragma link "dxRichEdit.Rtf.hpp"
(to the corresponding CPP file)
Other Document 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).
- HtmlText
- Specifies document content as a string (in the HTML format).
- OpenXmlBytes
- Specifies document content as a byte array (in the Office OpenXML format).
- Text
- Specifies document content (as a plain text string).
- LoadDocument | LoadDocumentTemplate | SaveDocument
- Export/import document content to/from a file or stream in any supported format.