Using TextFormatProvider
TextFormatProvider makes it easy to export RadFixedDocument to plain text format, preserving the document structure.
All you have to do in order to use TextFormatProvider is add references to the assemblies listed below:
- Telerik.Windows.Documents.Core.dll
- Telerik.Windows.Documents.Fixed.dll
Export
In order to export a document to plain text, you need to use the Export() method of TextFormatProvider.
Example 1 shows how to use TextFormatProvider to export RadFixedDocument to a string.
Example 1: Export RadFixedDocument to string
Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider provider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();
RadFixedDocument document = CreateRadFixedDocument();// CreateRadFixedDocument() is a custom method that creates a simple instance of RadFixedDocument. You can replace it with the instance you would like to export.
string documentContent = provider.Export(document);