如何在文件中查找内容 [英] How to find content in files

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

问题描述

我想查找包含特殊字符串的文件.如果文件格式为".txt",我知道该怎么做.如果文件是MS Word文档或"rtf",谁能告诉我该怎么做?

I want to find files including special strings. I know how to do it, if the file with format ".txt". Can anyone tell me how to do it, if the file is MS Word document or "rtf"?

推荐答案



有无数种文件格式.当您知道格式并想要访问文件内容时,理论上有几种策略:

1.
使用原始应用程序;它可能具有API,因此您可以对其进行接口.示例:Office通过主互操作程序集"具有API.

2.
寻找文件格式规范(它可以是公共的,可以是公共标准;也可以是专有的),并相应地实现您的代码.
示例:已记录RTF.

3.
找到实现#2的商业产品.

:)
Hi,

there is an infinite number of file formats. When you know the format and want to access the file content, theoretically there are a few strategies:

1.
use the original application; it may have an API so you can interface it. Example: Office has an API through the "Primary Interop Assembly".

2.
look for the file format specification (it may be public, it could be a public standard; it can also be proprietary), and implement your code accordingly.
Example: RTF is documented.

3.
find a commercial product that implements #2.

:)


这篇关于如何在文件中查找内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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