pyRTF and cells

  • Thread starter Raja Raman Sundararajan
  • Start date
R

Raja Raman Sundararajan

Hello,
I have been playing around with pyRTF module for generating rtf
documents.
Its a very nice tool that fits my basic needs. However I have a problem
controlling cells in
a table.

I am not able to
1. do an align right of contents inside a cell
2. set backgroundcolor of a cell
3. I wonder if there is a property to set cell height (?)

Do you guys have any input on this?

/R
 
T

Tim Churches

Raja said:
Hello,
I have been playing around with pyRTF module for generating rtf
documents.
Its a very nice tool that fits my basic needs. However I have a problem
controlling cells in
a table.

I am not able to
1. do an align right of contents inside a cell
2. set backgroundcolor of a cell
3. I wonder if there is a property to set cell height (?)

Do you guys have any input on this?

Yes. The correct approach is to:

a) do a Google search on "RTF specification", find the latest version of
the RTF specs, and read through them to determine whether what you want
to do is supported by RTF itself. If it is, then:

b) Ask Simon Cusack, the author of PyRTF, whether PyRTF supports these
attributes or if not, the best way to go about adding support for them, or

c) just add the features yourself to PyRTF and send Simon a copy of your
modified code.

Cheers,

Tim C
 
R

Raja Raman Sundararajan

Yeah, thats a good approach.
I have been fiddling around to implement that feature in elements.py
and RTF specification from msdn
However, I have not been successful thus far.

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top