Possible Duplicate:
Reading/Writing MS Word files in Python
I know there are some libraries for editing excel files but is there anything for editing msword 97/2000/2003 .doc files in python? Ideally I'd like to make some minor changes to the formatting of the text based on the contents of the text. A really trivial example would be highlighting every word starting with a capital.
Python can create and modify Word documents, which have the . docx file extension, with the python-docx module. You can install the module by running pip install python-docx .
Unfortunately, Word does not include this type of capability. Your options are either to rely on a third-party solution or write your own macro to do the changes. There are a number of third-party programs that offer the type of search-and-replace function necessary when working with multiple documents.
Select Edit Document > Edit in Browser. If anyone else is working on the document, you'll see their presence and the changes they're making. We call this coauthoring, or real-time collaboration. From here, if you'd rather work in your Word app, switch from Editing to Open in Desktop App, near the top of the window.
Why not look at using python-uno to load the document into OpenOffice and manipulate it using the UNO interface. There is some example code on the site I just linked to which can get you started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With