New to Telerik Document ProcessingStart a free 30-day trial

Using RtfFormatProvider

Updated on Feb 19, 2026

RtfFormatProvider makes it easy to import and export RadFlowDocument to/from RTF format, preserving the entire document structure and formatting.

All you have to do in order to use RtfFormatProvider is add references to the packages listed below:

  • Telerik.Windows.Documents.Core
  • Telerik.Windows.Documents.Flow

Import

In order to import an RTF document, you need to use the Import() method of RtfFormatProvider.

The code from Example 1 shows how to use RtfFormatProvider to import an RTF document from a file.

Example 1: Import document from a file

c#
Telerik.Windows.Documents.Flow.Model.RadFlowDocument document;

Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider();

using (Stream input = File.OpenRead("Sample.rtf"))
{
    document = provider.Import(input, TimeSpan.FromSeconds(10));
}

And here is how you can import a document from string containing the RTF document:

Example 2: Import document from a string

c#
Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider();
string input = File.ReadAllText("sample.rtf");

Telerik.Windows.Documents.Flow.Model.RadFlowDocument document = provider.Import(input, TimeSpan.FromSeconds(10));

The resulting RadFlowDocument can be used like any code-generated document.

Export

In order to export a document to RTF, you need to use the Export() method of RtfFormatProvider.

Example 3 shows how to use RtfFormatProvider to export RadFlowDocument to a file.

Example 3: Export a document to a file

c#
Telerik.Windows.Documents.Flow.Model.RadFlowDocument document;

Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider();

using (Stream output = File.Create("sample.rtf"))
{
    document = CreateRadFlowDocument();

    provider.Export(document, output, TimeSpan.FromSeconds(10));
}

You can also export the document to a string and preserve it in a database.

Example 4: Export a document to a string

c#
Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider();

Telerik.Windows.Documents.Flow.Model.RadFlowDocument document = CreateRadFlowDocument();

string output = provider.Export(document, TimeSpan.FromSeconds(10));

The resulting documents can be opened in any application that supports RTF documents.

See Also

In this article
ImportExportSee Also
Not finding the help you need?
Contact Support