[python-win32] create word document?

Tim Roberts timr at probo.com
Wed Oct 5 19:46:28 CEST 2005


On Tue, 4 Oct 2005 01:33:07 -0700 (PDT), ng hsiaohui 
<nghsiaohui at yahoo.com> wrote:

>I am creating MS word document using python win32.
>
>import win32com.client
>w = win32com.client.Dispatch("word.application")
>doc = w.Documents.Add("c:/test.doc")
>
>After that where can I find the command use to write
>contents in to this word document and to change the
>margin and fonts?
>


My approach to this is to Google for "microsoft word object model".  
Their documentation on their object model ebbs and flows, but you can 
usually find a reference somewhere.

However, I consider this a fairly odd request.  What are you actually 
trying to do?  If you want to generate and print formatted documents, 
you would have finer control and a much more flexible solution by using 
ReportLab to create PDF files, or HTML and the wxHtmlPrinting class in 
wxPython.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list