Python 中的 OLE 复合文档
如何使用 Python 解析 Microsoft OLE 复合文档?
编辑:抱歉,我忘了说我也需要写支持。简而言之,我有一个 OLE 复合文件,我必须读取它,修改一下并写回磁盘(它是一个文件)使用 CAD 应用程序制作)
how would you parse a Microsoft OLE compound document using Python?
Edit: Sorry, I forgot to say that I need write support too.. In short, I have an OLE compound file that I have to read, modify a bit and write back to disk (it's a file made with a CAD application)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了完整起见:在 Linux 上还有 GNOME 结构化文件库(但 Debian/Ubuntu 的默认包有Python 支持已禁用,因为 Python 绑定自 2006 年以来不再受支持)和 POIFS Java 库。
For completeness: on Linux there's also the GNOME Structured File Library (but the default package for Debian/Ubuntu has Python support disabled, since the Python bindings are unsupported since 2006) and the POIFS Java library.
刚刚找到OleFileIO_PL,
但它没有写支持..:/< /s> 从版本 0.40 (2014) 开始,它具有写入支持。编辑: 看起来有一种方法(尽管仅限 Windows)也支持写入.. pywin32 扩展(StgOpenStorage 函数和有关的)
Just found OleFileIO_PL,
but it doesn't have write support.. :/and as of version 0.40 (2014) it has write support.Edit: Looks like there's a way (though Windows-only) that supports writing too.. The pywin32 extensions (StgOpenStorage function and related)
另一种选择:xlrd 包有一个阅读器。 xlwt 包(pyExcelerator 的一个分支)有一个编写器。 他们可以轻松地处理数百 MB 的文件大小; 这些软件包已经广泛使用了大约 4 年。 复合文档模块的目标是尽可能高效地将“工作簿”流传入和传出 Excel .xls 文件,但具有相当的通用性。 与 OleFileIO_PL 不同,它们不提供对属性流内部的访问。
如果您决定使用它们并需要帮助,请在此论坛中提问:
http://groups.google.com/group/python-excel
An alternative: The xlrd package has a reader. The xlwt package (a fork of pyExcelerator) has a writer. They handle filesizes of 100s of MB cheerfully; the packages have been widely used for about 4 years. The compound document modules are targetted at getting "Workbook" streams into and out of Excel .xls files as efficiently as possible, but are reasonably general-purpose. Unlike OleFileIO_PL, they don't provide access to the internals of Property streams.
If you decide to use them and need help, ask in this forum:
http://groups.google.com/group/python-excel