Read word document in C#

ぃ、小莉子 提交于 2019-12-01 00:19:44

Unfortunately there are no good free options for reading .doc and .docx files. Even commercial options are sparse at reasonable prices, but there are good extremely expensive options.

For reading .doc files the only free option I'm aware of is POI for Java which you can run in .NET using IKVM. However, Word support in an experimental branch of POI's SVN repository, so I don't know how well it works.

http://poi.apache.org/

http://www.ikvm.net/

If you just want the text out of the .doc file and don't care about formatting, you can use the IFilter Win32 interface through pinvoke.

For reading .docx files you can use Microsoft Office Open XML SDK. Don't let "SDK" fool you though, this is a very light abstraction over the dealing with the XML directly. It's almost as painful to use.

http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&displaylang=en

For .docx your free option is DocX. Very advanced and easy to use. For doc I've not seen free alternative.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!