在 wpf 中导出 RadRichTextBox 内容

Export RadRichTextBox content in wpf

我想将 Telerik RadRichTextBox 导出到一个变量。

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

但是这段代码会显示这个错误:

Cannot convert from RadDocument to RadFlowDocument

您可能没有引用适当的 RtfFormatProvider class。

检查你的usings,或者直接调用:

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