在C#中读取带有格式化单词的doc文件 [英] Read doc file with formatted words in C#

查看:67
本文介绍了在C#中读取带有格式化单词的doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在寻找能够读取文档文件(.doc / .docx)的C#代码,所有格式化的文字包括图片,项目符号,字体和粗体/斜体/下划线,表格,页眉和页脚等。



我使用的是WordprocessingDocument.Open()和Microsoft.Office.Interop.Word.Application但是我无法准确找到。



请推荐一些不错的片段。



感谢adv 。

解决方案

如果你没有从OpenXml那里得到正确的结果那么就没有...



然而,

你可以做的是尝试解析XML(由WordprocessingDocument.Open()返回)并从那里得到预期的结果。



它有点辛苦的工作,但会按你的意愿工作。

例如你可以检查......

http://stackoverflow.com/questions/4824619/batch-conversion-of-docx -to-clean-html

Hi,

I am looking for C# code that will read document file (.doc/.docx) with all formatted words including images, bullets, font with bold/italic/underline, table, header & footer and so on.

I am using WordprocessingDocument.Open() and Microsoft.Office.Interop.Word.Application But unable to get exactly i am looking for.

Please suggest some good snippets.

Thanks in adv.

解决方案

If you are not getting proper results from OpenXml then there isn't any...

However,
what you can do is try parsing the XML (returned by WordprocessingDocument.Open()) and get the expected results from there.

Its bit laborious work but will work as you want.
For example you can check...
http://stackoverflow.com/questions/4824619/batch-conversion-of-docx-to-clean-html


这篇关于在C#中读取带有格式化单词的doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆