WinForms RichTextEditor Overview
RadRichTextEditor allows you to export and import its content. This is useful in case you want to save the user's input into a data base and then load it from there, or if you want to save/load the content of RadRichTextEditor to/from a file. To import and export you have to use a specific class that implements the IDocumentFormatProvider. You can find built-in classes, that implement this interface, for each of the supported formats. Currently RadRichTextEditor can export and import the following formats:
The Import/Export is part of Telerik UI for WinForms, a
professional grade UI library with 160+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
XAML: To import/export XAML documents you have to use the XamlFormatProvider class.
DOCX: To import/export DOCX documents you have to use the DocxFormatProvider class.
HTML: To import/export HTML documents you have to use the HtmlFormatProvider class.
RTF: To import/export RTF documents you have to use the RtfFormatProvider class.
Plain text: To import/export plain text documents you have to use the TxtFormatProvider class.
PDF: To export documents to PDF you have to use the PdfFormatProvider class.
Specifics
RadRichTextEditor's format providers can import/export a wide variety of features supported by the control. However, features which are not yet supported are stripped on import. Such examples are content controls like text boxes, check boxes, etc. which can be inserted in the document in some rich text editors such as Microsoft Word or can be included in the HTML.
When importing a document, it is converted to RadDocument following the rules of the model that it defines. Content that has no parallel in RadDocument is ignored and can no longer be restored. When exporting the same document, the resulting docx/HTML/XAML/RTF will be different than the initial one.