如何阅读任何办公文件 [英] How to read any office document

查看:80
本文介绍了如何阅读任何办公文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我想知道是否有任何类或库可以打开Office文档,然后阅读它们.

使用常规方法,创建StreamReader等等,有时例如,如果文档包含表格或图像,则会读取奇怪的字符.
例如,我要打开一个现有文件(.doc,.xls,.pub,.ppt等,甚至.pdf). ),阅读整个文档 然后计算每个单词出现多少次.

这可能吗?

我找到了一个名为iTextSharp的库,该库允许我创建文档,但是我不确定是否可以阅读它们,如果可以,我不知道该怎么做,因为没有文档.

非常感谢您,我希望有人能为我提供帮助,


我认为不可能完成您打算做的事情.原因是所有文档格式都遵循不同的规范来保存数据/文本.与纯文本文件不同,*.doc,*.xls,*.ppt等具有特定的格式,可以保存使用基于文本的文件流无法直接读取的数据.您需要特定的库,这些库知道如何读取和解释文档格式以通读这些格式.因此,您将不得不为每种不同的文件格式找到特定的库.

我希望这能给您一些解决问题的想法.

此致,
Saurabh Nandu
www.MasterCSharp.com
www.AksTech.com


Hi!

I'd want to know if there's any class or library to open office documents and then read them.

With the conventional method, creating a StreamReader and so, sometimes strange characters are read, for example if the document contains tables or images.
What I want to do is, for example, open an existing file (.doc, .xls, .pub, .ppt etc., even .pdf) , read the whole document  and then count how many times appears each word.

Is this possible?? How??
I found a library called iTextSharp which allows me to create documents but I'm not sure if I can read them, and if so I don't know how because there's no documentation.

Thank you very much, I hope there's someone who can help me,
                               
                                    Susana

解决方案

hi,

I don't think its possible to do what you plan to do. the reason is that all document formats follow a different specification for saving data/text. Unlike plain text files, *.doc, *.xls, *.ppt etc. have specific formats in which they save data which is not directly readable using a text based file stream. You need to you specific libraries that know how to read and intrepret the document formats to read through these. Hence you will have to find specific libraries for each of the different file formats.

I hope this gives you some idea to solve your problem.

Regards,
Saurabh Nandu
www.MasterCSharp.com
www.AksTech.com


这篇关于如何阅读任何办公文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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