如何提取在C#MS Office文档的文本 [英] How to extract text from MS office documents in C#

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

问题描述

我试图提取的MS Word(.DOC,.DOCX),Excel和PowerPoint使用C#文本(字符串)。我在哪里可以找到一个自由和简单的.NET库来读取MS Office文档?
我试图用NPOI但我没有得到有关如何使用NPOI样本。

I was trying to extract a text(string) from MS Word (.doc, .docx), Excel and Powerpoint using C#. Where can i find a free and simple .Net library to read MS Office documents? I tried to use NPOI but i didn't get a sample about how to use NPOI.

推荐答案

使用PInvokes可以使用的 IFilter的接口(在Windows上)。对于许多常见的文件类型的IFilter的安装与Windows(您可以使用这个工具,你可以只问的IFilter从文件返回你的文字有几套例如code的(的这里就是这样一个例子)。

Using PInvokes you can use the IFilter interface (on Windows). The IFilters for many common file types are installed with Windows (you can browse them using this tool. You can just ask the IFilter to return you the text from the file. There are several sets of example code (here is one such example).

这篇关于如何提取在C#MS Office文档的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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