tags:

views:

156

answers:

2

Hi everyone,
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)

A: 

Just found OleFileIO_PL, but it doesn't have write support.. :/

Edit: Looks like there's a way (though Windows-only) that supports writing too.. The pywin32 extensions (StgOpenStorage function and related)

Joril
+1  A: 

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.

http://pypi.python.org/pypi/xlrd
http://pypi.python.org/pypi/xlwt

If you decide to use them and need help, ask in this forum:

http://groups.google.com/group/python-excel

John Machin