Job*_*Joy 10
我使用TextRange获得了WPF的更好解决方案.
FlowDocument document = new FlowDocument();
//Read the file stream to a Byte array 'data'
TextRange txtRange = null;
using (MemoryStream stream = new MemoryStream(data))
{
// create a TextRange around the entire document
txtRange = new TextRange(document.ContentStart, document.ContentEnd);
txtRange.Load(stream, DataFormats.Rtf);
}
Run Code Online (Sandbox Code Playgroud)
现在,您可以在documentTextRange.Text中看到提取的文本
小智 5
你是否真的将.RTF加载到Word中?.net具有可以处理.RTF文件的RichTextBox控件.请参阅此处:http://msdn.microsoft.com/en-us/library/1z7hy77a.aspx(如何:将文件加载到Windows窗体RichTextBox控件中)
| 归档时间: |
|
| 查看次数: |
14988 次 |
| 最近记录: |