将 docx 文件转换为 WPF 流文档
我正在尝试将一堆 Microsoft Word 文档(包含一些图片和多行文本以及标题)转换为流文档。
我发现 这篇文章很有用,但我无法将 docx 文件中的图像正确添加到流文档中。
示例代码或一些指导将不胜感激。
I'm trying to convert a bunch of Microsoft Word documents, containing a few pictures and many lines of text and headings to Flow Documents.
I found this article useful, but I couldn't add images form docx files to Flow Documents properly.
A sample code or some guidance would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是较流行的转换器之一:Word 到 XAML 转换器。它并不完美,但这是一个很好的开始。 OpenXML + FlowDocument = OpenFlowDocument? 上还有一篇关于此主题的好文章,其中适用于 WPF。最后,您可以查看 TextGlow - 虽然它是针对 Silverlight 并且不使用 FlowDocument,但很高兴看到他是如何做的使用 Linq 进行一些转换。
This is one of the more popular converters: Word to XAML Converter. It ain't perfect, but it's a great start. There's also a good article on this subject at OpenXML + FlowDocument = OpenFlowDocument? which is for WPF. Finally, you can check out TextGlow - although it's for Silverlight and not using FlowDocument, it's good to see how he does some of the conversions with Linq.
您也可以查看这篇文章:在 WPF 中显示 Word 文件
这也不是一个完整的解决方案,但我相信它可以很容易地增强,这篇文章对 DOCX 文件元素及其相应的 FlowDocument 元素有非常好的解释。
Also you can check out this article: Show Word file in WPF
This is also not a complete solution, but I believe it can be easily enhanced, the article has a really nice explanation of DOCX file elements and their corresponding FlowDocument elements.