在C#中阅读word文档 [英] Read word document in C#

查看:160
本文介绍了在C#中阅读word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读服务器中的Word文档(DOC都和DOCX)。服务器不具备
办公室安装,所以我不能使用COM对象,也没有商业软件。

I want to read a word document in the server (both doc and docx). The server does not have office installed, therefore i can't use com objects and also no commercial softwares.

有没有办法,我可以单独使用的办公工具,读取Word文档的方法(2003年和2007年)

Is there a way that I can use office tools alone and read the word docs (2003 and 2007)

推荐答案

不幸的是阅读doc和docx文件没有很好的自由选择。即使是商业场所以合理的价格稀疏,但也有很好的极其昂贵的选项。

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.

有关阅读.doc文件唯一的自由选择我所知道的是POI的Java,您可以在.NET中使用IKVM运行。然而,字POI的SVN库的实验分支支持,所以我不知道它有多好了!

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/

如果你只是想要的文字出来的.doc文件,并不在乎格式,可以使用的通过PInvoke的IFilter的的Win32接口。

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.

有关读取.DOCX文件,您可以使用微软的Office Open XML SDK。不要让SDK愚弄你,虽然,这是在直接与XML的处理很轻的抽象。这几乎是痛苦的使用。

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.

<一个href=\"http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&displaylang=en\" rel=\"nofollow\">http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&displaylang=en

这篇关于在C#中阅读word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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