如何从Word文档中提取RTF/HTML文本?
上下文:我使用 Microsoft 发布的 DSOFramer 示例将 Word 嵌入到 Winforms 中。 现在,我可以使用 Word 文档的所有格式选项编写文本。
问题:我可以使用 doc.Content.Text 从文档中提取基本文本(doc 是对我的 Word 文档的引用),但我不知道如何获取带格式的文本,无论是 RTF 还是 as HTML。 我希望 Word 文档具有类似于 RichTextBox 中的 Rtf 属性的内容,但似乎并非如此。 那么我该如何获取格式化文本呢?
Context : I embedded Word into a Winforms using the DSOFramer sample published by Microsoft. Now, I can write text with all formatting options of a Word document.
Question : I can extract the basic text from the doc, using doc.Content.Text (doc is a reference to my Word document), but i can't figure out how I can get the text with formatting, either as RTF or as HTML. I hopped Word docs had something similar to the Rtf attribute in the RichTextBox, but it doesn't seem so. So how am I supposed to get the formatted text ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用剪贴板:
You can use the clipboard: