[reportlab-users] simple tables example

Shayan Raghavjee shayanr at sjsoft.com
Thu Dec 23 04:07:14 EST 2004


I may be wrong, haven't used ReportLab much in a few months, but....

Timothy Smith wrote:

>
> ok an update
>
> i found a small example but now i get this
>
> File "/usr/home/timothy/Projects/PubWare/python/WeeklyReportPDF.py", 
> line 29, in MakeReport
>    t = Table(WeeklyReport, rowheight, colwidth)
>  File 
> "/usr/local/lib/python2.3/site-packages/reportlab/platypus/tables.py", 
> line 149, in __init__
>    elif len(colWidths) != ncols:
> TypeError: len() of unsized object
>
> here is my code
>
> doc = SimpleDocTemplate('tmp.pdf')
>      WeeklyReport = ('test','test','test')

Shouldn't this be a list of lists, the tabledata should normally 
resemble a grid I think?
WeeklyReport = [['test', 'test', 'test']]
or
WeeklyReport = [['test', 'test', 'test'],
                            ['test', 'test', 'test']]

>  
>    rowheight=(10)
>    colwidth = (16,16,16)

These should be lists too,
rowheight = [10]
colwidth = [10, 10, 10]

>    t = Table(WeeklyReport, rowheight, colwidth)
>    doc.build(t)
>
>

That should work, shouldn't it?


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.0 - Release Date: 2004/12/17



More information about the reportlab-users mailing list