> I've been trying to figure out how to insert data into the header and footer
> objects of a MS Word document. I've read the Word Object Model Overview on
> http://msdn2.microsoft.com/en-us/library/kw65a0we(VS.80).aspx and have the
> Hammond's Python Programming on Win32 book. The I've tried fiddling with the
> MSDN code and have been unsuccessful. The book doesn't discuss headers and
> footers. Does anyone know how to do it?

Here's a translation of this example:
http://msdn2.microsoft.com/en-us/library/ms178795(VS.80).aspx


import win32com.client
w=win32com.client.gencache.EnsureDispatch('Word.Application',0)
w.Visible=1
w.Documents.Open('somedocument.doc')
s=w.ActiveDocument.Sections[0]
s.Footers(win32com.client.constants.wdHeaderFooterPrimary).Range.Text='I am a 
footer'

        Roger

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to