New to Telerik UI for WinFormsStart a free 30-day trial

Using RtfFormatProvider

Updated on May 7, 2026

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

To use RtfFormatProvider, you should reference the Telerik.WinControls.RichTextEditor.dll assembly and add the following namespace:

  • Telerik.WinForms.Documents.FormatProviders.Rtf

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.

Import Document from a File

C#
RtfFormatProvider provider = new RtfFormatProvider();
using (Stream input = File.OpenRead(@"..\..\RichTextEditor\ImportExport\Sample.rtf"))
{
    this.radRichTextEditor1.Document = provider.Import(input);
}

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

Import Document from a String

C#
RtfFormatProvider provider = new RtfFormatProvider();
this.radRichTextEditor1.Document = provider.Import(input);

The resulting RadDocument 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.

The example below shows how to use RtfFormatProvider to export RadDocument to a file.

Export a Document to a File

C#
RtfFormatProvider provider = new RtfFormatProvider();
using (Stream output = File.Create("Sample.rtf"))
{
    RadDocument document = this.radRichTextEditor1.Document;
    provider.Export(document, output);
}

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

Export a Document to a String

C#
RtfFormatProvider provider = new RtfFormatProvider();
RadDocument document = this.radRichTextEditor1.Document;
string output = provider.Export(document);

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