Editing/Writing Word-Files from Python
peter at engcorp.com
Tue Apr 20 17:33:56 CEST 2004
Daniel Cloutier wrote:
> is it possible to edit or write Word-files out of a Python-Program?
Word uses a proprietary binary format, so you don't really
have as an option the simple "open file, make some changes,
write file" approach you might be picturing.
On the other hand, this *is* Python, so you have alternatives:
1. Use ActiveX and control Word from Python. This is described
well in Mark Hammond's book on Win32 programming with Python,
web pages (use Google), and posts in the comp.lang.python archives.
2. Write HTML or RTF files, which are not proprietary binary
formats. These can be edited in Python and then written back
again. Not sure if there's an RTF library, but "it's just text".
3. Define in more detail what you are actually looking for
("edit" is ill-defined) including the context, and you'll
probably get another three or four ways of doing it.
More information about the Python-list