Estimated read time: 2 minutes
mso-dumper is a project that creates some — more or less human-readable — dump from binary files. Initially Kohei Yoshida developed it to dump XLS, then Thorsten Behrens added support for PPT files, finally during last November I started to add DOC support.
You may ask: why that is useful? My answer is that I spend quite some time on the import/export filters of LibreOffice Writer, and to be able to improve or fix such filters, some knowledge of the file format in question and Writer internals is needed. Regarding the file format knowledge, I find it much easier to read the specification once and implement some simple dumper based on that — than reading the specification again and again, and just trying to understand what’s going on inside a binary file using a hex editor.
To my knowledge, such a dumper for the DOC format (in particular the WW8 version of it) did not exist previously. WW8Dumper was the closest match, but that was far from complete and I found extending mso-dumper easier.
To stress-test the parser, I used get-bugzilla-attachments-by-mimetype to get all DOC attachements from the Freedesktop bugzilla, and during the last days I fixed the remaining crashes (actually this is why I write this post now ;-) ). If you want to try it out you can do so by:
git clone git://anongit.freedesktop.org/libreoffice/contrib/mso-dumper cd mso-dumper ./doc-dump.py /path/to/doc/file.doc
The idea is that on any input the dumper should not crash: instead either it
should give you usable result, or in case some unhandled structure is reached,
it should print a
<todo> XML tag. Other than that, of course patches welcome — that said, Maxime de Roucy already contributed a patch to the DOC part of
mso-dumper, thanks! :-)