pyRTF and cells

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raja Raman Sundararajan

    #1

    pyRTF and cells

    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

  • Tim Churches

    #2
    Re: pyRTF and cells

    Raja Raman Sundararajan wrote:[color=blue]
    > 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?[/color]

    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

    Comment

    • Raja Raman Sundararajan

      #3
      Re: pyRTF and cells

      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:[color=blue]
      > 1. do an align right of contents inside a cell[/color]
      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 ParagraphProper tySet object
      Snippet:

      p = Paragraph( ss.ParagraphSty les.Normal, ParagraphPS(ali gnment=2)
      )
      p.append(<some text here>)
      c1 = Cell(p)

      Comment

      Working...