Re: MS word document generator

2006-03-23 Thread Raja Raman Sundararajan
Hi paron,
I am using PyRTF as of now and it seems to fit my need quite well
and it works like a charm :-).
I have made a wrapper around it so that it will easier for me to switch
the backend for generating the word/RTF docs later.
May be, it will be openoffice :-)
I appreciate your input. Thank you.

:-)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-16 Thread M�ta-MCI
Hi!

Yes, I have an idea. But... I has no time, actually.
Perhaps in 2 or 3 weeks...  Sorry.

Michel Claveau


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-16 Thread paron
You might also consider OpenOffice, which writes to ODF. That way,
you're working to a standard. You can script OpenOffice in Python
(http://udk.openoffice.org/python/python-bridge.html) . OpenOffice can
save in .doc, and does a pretty good job of making a file that most MS
Word versions will render properly.

According to http://opendocumentfellowship.org/Devel/LibOpenDocument,
there is a Python API in development, but I don't know how far along
they are. ODF isn't too bad to hack, if you need to do that.

Ron

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Max M
Raja Raman Sundararajan wrote:
 I was wondering if there was any library as reportlab to generate word
 documents.

If you are on Windows, why dont you use word for it? You can call it 
from Python.


-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

Phone:  +45 66 11 84 94
Mobile: +45 29 93 42 96
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Tim Churches
Raja Raman Sundararajan wrote:
 Hello guys,
 Is there any nice library to generate word documents using Python.
 
 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.
 
 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.

How about PyRTF to generate Rich Text Format documents which MS-Word
will lap up? Thanks to the efforts of Simon Cusack (hi Simon).

See http://cheeseshop.python.org/pypi/PyRTF/0.45

Tim C

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Raja Raman Sundararajan
Hi Tim,
Thanks for your PyRTF suggestion. I am checking it out now
:-)
/R

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Grant Edwards
On 2006-03-15, Raja Raman Sundararajan [EMAIL PROTECTED] 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Raja Raman Sundararajan
Hi guys,
Thanks for your note Grant.
I had a look at the pyRTF and it seems to be quite impressive :-)
I actually works for my needs except the below, concerning cells in a
table

For cells in a table, pyRTF does not support
1. ALIGN_RIGHT
2. Cell background

Do you guys have any idea of how to do this?

Thanks
/R

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread M�ta-MCI
Hi!

PyRTF is old, but run OK. I use it, with some little modifs, for another 
usage.

It was good to remember it.

MCI


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread M�ta-MCI
Hi!

The next MS-Office come with a new format of document, based on XML+Zip.
But MS-Word can read, now, a XML file.

Perhaps you can use this way.

@-salutations

Michel Claveau



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Raja Raman Sundararajan
Hi Michel,
Well,  Office 12 will have very many features. Thats true.
But my document needs to work in all versions of Office.
I hope that pyRtf generated file is fully rtf compatible. :-)
But so far I think it is quite okay.


To answer my first question:
 1. do an align right of contents inside a cell

Its not possible by speficying alignment in the Cell instance

However, if you really want this feature then create a Paragraph and
then set alignment=2 for the ParagraphPropertySet object
Snippet:
p = Paragraph( ss.ParagraphStyles.Normal, ParagraphPS(alignment=2)
)
p.append(some text here)
c1 = Cell(p)

I need to fiddle around with the RTF to see if I can implement coloring
of Cells

:-)
/R

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Sybren Stuvel
Raja Raman Sundararajan enlightened us with:
 Well,  Office 12 will have very many features. Thats true.
 But my document needs to work in all versions of Office.
 I hope that pyRtf generated file is fully rtf compatible. :-)

Oh come on. Even Word files don't work in all versions of Office.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS word document generator

2006-03-15 Thread Grant Edwards
On 2006-03-15, Sybren Stuvel [EMAIL PROTECTED] wrote:
 Raja Raman Sundararajan enlightened us with:
 Well,  Office 12 will have very many features. Thats true.
 But my document needs to work in all versions of Office.
 I hope that pyRtf generated file is fully rtf compatible. :-)

 Oh come on. Even Word files don't work in all versions of Office.

RTF is far more portable between versions office.  At my
previous employer, all controlled documents that were generated
using office were archived in RTF format.

-- 
Grant Edwards   grante Yow!  .. I think I'd
  at   better go back to my DESK
   visi.comand toy with a few common
   MISAPPREHENSIONS...
-- 
http://mail.python.org/mailman/listinfo/python-list