Analysing Word documents (slow) What's wrong with this code please!

Daniel Dittmar daniel.dittmar at sap.com
Mon Jan 19 05:49:19 EST 2004


jmdeschamps wrote:
> Anyone has a hint how else to get faster results?
> (This is to find out what was bold in the document, in order to grab
> documents ptoduced in word and generate html (web pages) and xml
> (straight data) versions)
[...]
> for i in range(len(MSWord.Documents[0].Content.Text)):
>     if MSWord.Documents[0].Range(i,i+1).Bold  : # testing for bold

Perhaps you can search for bold text. The Word search dialog allows this.
And when you use the keybord macro recording feature of Word, you can
probably figure out how to use that search feature from Python.

Daniel






More information about the Python-list mailing list