Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a python library for editing msword doc files? [duplicate]

Tags:

python

ms-word

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.

like image 461
Eugene M Avatar asked Dec 17 '08 21:12

Eugene M


People also ask

Can Python edit a Word document?

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 .

Is there a way to update multiple Word documents at once?

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.

How do you edit the same document in Word?

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.


1 Answers

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.

like image 158
Adam Pierce Avatar answered Oct 02 '22 00:10

Adam Pierce