[reportlab-users] Word wrap on Table.

Pedro Ghilardi pghilardi at gmail.com
Mon Feb 8 09:58:22 EST 2010


You are right. With this configuration the error doesn't appears.
After that I investigated the code that draws the table on the
document (we have a specific class to do this, instead of the
SimpleDocTemplate) and I found an error calculating the available
width to draw the table! Summarizing, the error wasn't on the table
construction but on the table drawing.

Thanks for you help Robin.

On Mon, Feb 8, 2010 at 11:59 AM, Robin Becker <robin at reportlab.com> wrote:

> 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

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>




--
Pedro Ghilardi
email: pghilardi at gmail.com
homepage: http://www.pedroghilardi.rg3.net


More information about the reportlab-users mailing list