如何加载在C#(.NET)MS Word文档的文本? [英] How to load text of MS Word document in C# (.NET)?

查看:204
本文介绍了如何加载在C#(.NET)MS Word文档的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何加载MS Word文档(.doc和.DOCX)内存(变量)不这样做?

How do I load MS Word document (.doc and .docx) to memory (variable) without doing this?:

wordApp.Documents.Open

我不希望打开微软的Word,我只是想里面的文本。

I don't want to open MS Word, I just want that text inside.

您给了我答案DOCX,但对于DOC?我想要自由和高性能的解决方案 - 不要打开Word的12.000实例来处理所有的人。阅读Aspose :(是商业产品,而900 $是太多我做​​什么。

You gave me answer for DOCX, but what about DOC? I want free and high performance solution - not to open 12.000 instances of Word to process all of them. :( Aspose is commercial product, and 900$ is a way too much for what I do.

推荐答案

您可以使用wordconv.exe这是Office兼容包的一部分,从文档转换为DOCX。

You can use wordconv.exe which is part of the Office Compatibility Pack to convert from doc to docx.

<一个href="http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en" rel="nofollow">http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en

只需调用命令,如下所示: C:\ Program Files文件\微软的Office \ OFFICE12 \ wordconv.exe-oice -NMe的InputFile OUTPUTFILE

Just call the command like so: "C:\Program Files\Microsoft Office\Office12\wordconv.exe" -oice -nme InputFile OutputFile

我不知道,如果你需要安装字为它运行,但它的工作。我在本地使用它作为一个Windows shell命令时,我想老Office文件转换到2007格式。

I'm not sure if you need word installed for it to run but it does work. I use it locally as a windows shell command to convert old office files to 2007 format whenever I want.

这篇关于如何加载在C#(.NET)MS Word文档的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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