[reportlab-users] tables in tables.....in tables

Shayan Raghavjee reportlab-users@reportlab.com
Wed, 29 Oct 2003 10:07:55 +0200


Hi again,

Please excuse the spelling if it's bad, I'm writing this while my laptop 
is beeping a battery warning at me, so I'm going as fast as I can.

Bit of a newbie question, but is it possible to include a table in 
another table, I've seen it mentioned in the docs, but I can't find an 
example. A snippet of code I've tried and which doesn't work:

           tCol1List = [tBlock1, tBlock2]
           subTable1 = Table(tCol1List, style=LargeTableStyle(), 
repeatRows = 0)
           tCol2List = [tBlock3, tBlock4, tBlock5, tBlock6]
           subTable2 = Table(tCol2List, style=LargeTableStyle(), 
repeatRows = 0)
           dataTableList = [subTable1, subTable2]
           dataTable = Table(dataTableList, style=LargeTableStyle(), 
repeatRows = 0)

where the tBlock variables are already working tables (ie, they work on 
their own). ie. I want 2 tables on one side, with 4 on the other, and 
I've made 2 subtables so that the 'main' table only has 1 row with 2 
columns.
Is there anything wrong with that code? Does the table need to be 
arranged in a ceratin way? Is the depth too much?

I get the following error, if it helps:

 File "c:\Projects\jSuite.py\Falke\web\ticketweb.py", line 306, in 
genTickets
   subTable1 = Table(tCol1List, style=LargeTableStyle(), repeatRows = 0)

 File "C:\Python22\reportlab\platypus\tables.py", line 148, in __init__
   if len(data[i]) != ncols:



AttributeError: Table instance has no attribute '__len__'


Againj, thanks for any help.

Shayan Raghavjee,
St. James Software