Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

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 textFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider(); 
 
RadFixedDocument document = new RadFixedDocument(); 
using (RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(document)) 
{ 
    radFixedDocumentEditor.InsertLine("Sample line."); 
    radFixedDocumentEditor.InsertRun("Sample run."); 
} 
 
string documentAsText = textFormatProvider.Export(document);