它用于应用程序的帮助部分。我正在考虑将 flowdocumentReader 用于显示帮助文档。但是是否可以显示 .rtf 或任何 .doc 以显示在 Flowdocument 中。或者是否需要在 Xaml 中创建流文档。请帮忙。
谢谢,
它用于应用程序的帮助部分。我正在考虑将 flowdocumentReader 用于显示帮助文档。但是是否可以显示 .rtf 或任何 .doc 以显示在 Flowdocument 中。或者是否需要在 Xaml 中创建流文档。请帮忙。
谢谢,
这些行中的某些内容将为您完成工作,其中 documentPath 是您的 rtf 文件路径:
FileStream fileStream = File.Open(documentPath, FileMode.Open, FileAccess.Read, FileShare.Read);
FlowDocument flowDocument = new FlowDocument();
TextRange textRange = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd);
textRange.Load(fileStream , DataFormats.Rtf);
请添加错误检查代码。