[reportlab-users] Tables in tables

S Raghavjee reportlab-users@reportlab.com
Tue, 28 Oct 2003 15:58:20 +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). 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