“C”语言的 Microsoft Word 文本解析器
我想知道从 Microsoft Word(.doc 和 .docx)文档中解析和获取文本内容的过程。 使用的编程语言应该是纯“C”(应该是 gcc)。
是否有任何库已经完成这项工作,
扩展:我可以使用相同的过程来解析 Microsoft power point 文件中的文本吗?
I would like to know the procedure to adopt to parse and obtain text content from Microsoft word (.doc and .docx) documents . programming language used should be plain "C" (should be gcc).
Are there any libraries that already do this job,
extension : can i use the same procedure to parse text from Microsoft power point files also ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Microsoft Word 文档是一个巨大的野兽 - 您绝对不想自己编写这些代码。 考虑使用现有的免费 Word 库,例如 antiword 或 wvWare。
Microsoft Word documents are an enormous beast - you definitely don't want to be writing this code yourself. Look into using an existing free Word library such as antiword or wvWare.
我不知道是否存在库,但格式规范可从 Microsoft 免费并承诺不会因使用它们而起诉您。
I don't know about libraries that exist, but the format specifications are available from Microsoft for free and under a promise not to sue you for using them.
在 Windows 上,让 word 完成这项工作并与 COM 对象交互,在 Linux 上,这项工作是在 antiword< 中完成的/a>. 或者,您可以使用 OpenOffice.org 在任何平台上实现自动化。 services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Professional_UNO" rel="nofollow noreferrer">UNO 对象模型。
on windows, let word do the job and interface with the COM object, on linux, the job was done in antiword. Or you can automate OpenOffice.org on any platform with the UNO object model.
如果您愿意尝试在 C 语言中使用 COM 接口,则可以使用 IFilter 接口内置于 Windows 2000 以来的每个版本的 Windows 中。您可以使用它从任何 Office 文档(Word、Excel 等)中提取文本、PDF 文件或安装了 IFilter 支持的任何文件类型。
我写了一个 博客几年前发布了关于它的文章。 全部都是 C++,但您可以使用 C 中的 COM 对象。
If you're willing to go through the effort of using a COM interface in C, you can use the IFilter interface built into every version of Windows since Windows 2000. You can use it to extract text from any office document (Word, Excel, etc.), PDF file or any file type that has IFilter support installed.
I wrote a blog post about it a few years back. It's all C++, but you can use COM objects from C.