using python to edit a word file?

John Salerno johnjsal at NOSPAMgmail.com
Thu Aug 10 14:51:23 EDT 2006


Rob Wolfe wrote:
> John Salerno <johnjsal at NOSPAMgmail.com> writes:
> 
>> I figured my first step is to install the win32 extension, which I
>> did, but I can't seem to find any documentation for it. A couple of
>> the links on Mark Hammond's site don't seem to work.
>>
>> Anyway, all I need to do is search in the Word document for certain
>> strings and either delete them or replace them. Easy enough, if only I
>> knew which function, etc. to use.
>>
>> Hope someone can push me in the right direction.
> 
> Maybe this will be helpful:
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/279003
> 

But if I save the file to text, won't it lose its formatting?

More specifically, here's what I have: a four-page calendar, each page 
with three months on it. The months are in tables, which is why I don't 
think making a text file will help me here, because I'll lose all that. 
What I need to do is renumber all the dates, basically replacing a 
number with itself minus 1. So it's not a simple find/replace task, and 
there doesn't seem to be a way to do this in Word's find/replace feature 
(but if there is, please let me know!)



More information about the Python-list mailing list