MS Word Outline -> reStructuredText script?

Graham Fawcett graham.fawcett at gmail.com
Fri Oct 14 22:33:30 CEST 2005


Jim wrote:
> Hi,
>
> I'm using reStructuredText as a format for some group documentation,
> and often my co-workers take notes during meetings in Word's outline
> mode.  Does anyone already have a python script that will convert from
> Word (or the Open Office file format version of a word document) to
> reStructured Text?

I don't have a script; but if you have to roll your own, you might
consider having your colleagues save their Word documents in XML
format. Office 2003, and perhaps slightly earlier versions, do this.
Then you can "simply" parse the XML and transform it into anything you
like, including a reST document.

If you cannot convince them, then you could also have your script
automate Word, via win32com.client.Dispatch('Word.Application'), and do
the save-as-XML yourself before parsing the generated XML. At the end
of the day, I think this would be easier than, e.g., trying to use
win32com to traverse the document's object model.

Graham




More information about the Python-list mailing list