Search code examples
c#wpftelerikrichtextbox

Export RadRichTextBox content in wpf


I want to export Telerik RadRichTextBox to a variable.

(new RtfFormatProvider()).Export(RadRichTextBox1.Document)

But this code will show this error:

Cannot convert from RadDocument to RadFlowDocument


Solution

  • You probably don't reference the appropriate RtfFormatProvider class.

    Check your usings, or explitly call:

    (new Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider()).Export(RadRichTextBox1.Document)