MS word document generator

Grant Edwards grante at visi.com
Wed Mar 15 10:11:44 EST 2006


On 2006-03-15, Raja Raman Sundararajan <ram0812 at hotmail.com> wrote:

> Is there any nice library to generate word documents using Python.

I find the following works well for me:

f = open("file.doc")
f.write("Hello there.\n")
f.write("How are you?\n")
f.close()

> As of today I am generating a HTML document and then open it
> with MS Word. But the problem is that I am not able to control
> the pages in the document and as a result of it the output
> looks terrible.

If you want fancier formatting that available in my example
code, I'd look for a library to generate RTF.  Something like
this perhaps (I haven't tried it yet):

   http://pyrtf.sourceforge.net/

RTF is far more portable that whatever ".doc" format-du-jour
happens to be in vogue in Redmond.
   
> I have been using reportlab's platypus to generate PDF
> documents. Its a nice application which allows controlling
> segments of the pages programatically.
>
> I was wondering if there was any library as reportlab to
> generate word documents.

-- 
Grant Edwards                   grante             Yow!  ... I have read the
                                  at               INSTRUCTIONS...
                               visi.com            



More information about the Python-list mailing list