[reportlab-users] Word wrap on Table.

Robin Becker robin at reportlab.com
Mon Feb 8 08:59:01 EST 2010


I'm not seeing this problem with the following which uses the rows with varying
widths

#########################
from reportlab.platypus.paragraph import Paragraph
from reportlab.platypus.tables import Table, TableStyle
from reportlab.platypus.doctemplate import SimpleDocTemplate
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
styles = getSampleStyleSheet()

S=[].append
for w in (36,72,144,288,None):
A={}
if w: A['colWidths'] = w
S(Paragraph('width=%s' % w, styles['Normal']))
S(Table([[Paragraph('Header title 1', styles['Normal']),Paragraph('Header
title 2', styles['Normal'])],
[Paragraph('a', styles['Normal']),Paragraph('b', styles['Normal'])],
[Paragraph('c', styles['Normal']),Paragraph('d', styles['Normal'])]],
style=TableStyle([('GRID', (0,0), (-1,-1), 0.25, colors.black)]),
**A))
SimpleDocTemplate('ttw.pdf').build(S.__self__)
#########################
--
Robin Becker


More information about the reportlab-users mailing list