从旧的 Word 文件中提取元数据(从 2.0 开始)

发布于 2024-09-28 06:11:54 字数 653 浏览 0 评论 0原文

我必须从大量(我的小型工作样本有数百个,总数可能是数千个)Microsoft Office 文件(主要是 Word 文件)中提取元数据。

这些文件的Word版本从Word 2.0到Word 2007。

我必须在.net 3.5(使用c#)中完成它,它是一个本地winforms应用程序。

我想,我可以使用 OLE Automation (DsoFile.dll) 从最新的元数据中提取元数据。我和其中一些人成功地做到了这一点。

问题是 DsoFile 不支持旧格式。他们可能不使用 OLE。

我做了很多谷歌搜索,发现获取我想要的数据的最佳(可能是唯一)方法是使用反词(http://www.winfield.demon.nl/)。 使用反词,我可以调用它的过程并收集它的输出。它可以提取一些数据,但不是我需要的全部数据。 示例:反词只给我一个存储日期,而我需要其中两个。

还有 wvware,但我猜它是仅限 Linux 的。

另一个选择是 gnu libextractor,但我找不到在 .net

Office Interop 上使用的方法,这将是绝望的最后手段。我还没有测试过这个选项,但我猜当一个人想要以良好的性能处理大量文件时,这不是一个选择。

有人可以帮忙吗?如果您需要更多数据,请询问。

对不起我的英语,我不是母语人士。

I have to extract metadata from a lot (my small working sample has hundreds, the total will probably be thousands) of Microsoft Office files, mostly Word ones.

These files Word versions go from Word 2.0 to Word 2007.

I have to do it in .net 3.5 (using c#) and it's a local winforms application.

I can extract metadata from the most recent ones with OLE Automation (DsoFile.dll), i think. I did it successfully with some of them.

The problem is that the older formats aren't supported by DsoFile. They dont use OLE, probably.

I did a lot of googling and i found that the best (are probably the only) way to get the data i wanted was using antiword (http://www.winfield.demon.nl/).
With antiword i can invoke its process and collect its output. It can extract some of the data but not all that i need.
Example: antiword gives me only one of the stored dates and i need two of them.

There's also wvware but i guess it's linux-only.

Another option would be gnu libextractor but i can't find a way to use in on .net

Office Interop would be a desperate last resort. I haven't tested that option but i'm guessing it's not a option when one wants to process a huge amount of files with decent performance.

Can anyone help? If you need more data, just ask.

Sorry for my english, i'm not a native speaker.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野味少女 2024-10-05 06:11:54

我曾经在商业办公室元数据提取和报告工具上工作。这不是一件容易的事,特别是如果您还想删除任何元数据。从它的声音来看,你只是想报告它,所以这样更好。

从 word2000 开始,Word 文件存储在 OLE 复合文档中。网上有很多关于阅读这些文件的文档,但请记住,这只能为您提供元数据的一小部分。 Word 文档的大部分“内容”都作为大型二进制 blob 存储在复合文档文件中,并且这些 blob 的格式是专有的。

网上有 DOC 文件格式的文档。

http://msdn.microsoft.com/en-us/library/cc313118.aspx

但这是一个庞大的规范并且极其复杂。尽管如此,您也许能够找出那些您需要处理的部分。

较新的 DOCX 文件更容易处理(并且潜伏的元数据也少得多)。

I used to work on a commercial office Metadata extraction and reporting tool. It ain't an easy task, esp if you also want to remove any of that metadata. From the sound of it, you're looking to just report on it, so that's better.

As of word2000, Word files were(are) stored in OLE Compound documents. There's plenty of docs online about reading those files but keep in mind that'll only get you a small subset of metadata. Most of the "meat" of a word doc is stored as big binary blobs within the compound doc file and the format of those blobs is proprietary.

There's documentation on the web for the DOC file format.

http://msdn.microsoft.com/en-us/library/cc313118.aspx

But it's a MASSIVE spec and insanely complicated. Still, you might be able to ferret out just those pieces you need to deal with.

The newer DOCX files are much easier to deal with (and have a lot less metadata lurking about too).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文