Alignment in table with flexible data

Helga Peters <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CALA9yC1BN9_XHn0LxDCHUzB0GexW67TZL_Xw6un6k5KL_=8HPQ@mail.gmail.com>
Hello,

I'm working at a table in a report with flexible data. I used paragraphs to
wrap the flexible lenght of text and that works well.
The only thing I'm wrestling with is the alignments (ALIGN and  VALIGN)
which work fine in the first report data, but the alignments do not work
anymore when the subsequent set of data runs through. However, the spanning
(SPAN) for the does work in the first and subsequent set(s) of data.
Any suggestions ?
Below my code.
Thanks in advance,
Helga


t_data = [   ('Report(s):', '','') ]

t_style = [  ('FONT', (0, 0), (1, 0), 'Helvetica-Bold'),
                  ('ALIGN', (2,1), (2,3), 'CENTER')            ]

for rpt in report:
      if rpt.image_url != None :
           I = Image(rpt.image_url)
           I.drawHeight = 3 * cm * I.drawHeight / I.drawWidth
           I.drawWidth  = 3 * cm
      else:
           I = ''

      ptext0 = '%s' % rpt.place
      cell0 = [Paragraph(ptext0, styles['Normal']) ]
      t_style += [  ('SPAN', (2, len(t_data)), (2, len(t_data)+2)),
                          ('VALIGN',(0,1),(1,1),'TOP')     ]
      t_data.append(('Place:' , cell0 , I ))

      ptext1 = '%s' % rpt.description
      cell1 = [Paragraph(ptext1, styles['Normal']) ]
      t_style += [  ('ALIGN', (0,2), (1,2), 'LEFT'),
                          ('VALIGN',(0,2),(1,2),'TOP')   ]
      t_data.append(('Description:', cell1,''))


t2=Table(t_data, colWidths=[30*mm,90*mm,45*mm], style= t_style, repeatRows
= 1)

story.append(t2)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.