[reportlab-users] Alignment in table with flexible data
Helga Peters
helga at full-control.nl
Tue May 12 07:59:36 EDT 2015
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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20150512/e89b95d4/attachment.html>
More information about the reportlab-users
mailing list