[reportlab-users] multipage table

Timothy Smith timothy at open-networks.net
Sun Jun 5 03:32:20 EDT 2005


Timothy Smith wrote:

> Timothy Smith wrote:
>
>> Robin Becker wrote:
>>
>>> Timothy Smith wrote:
>>> ....
>>>
>>>>
>>>> test_platypus_tables.pdf that it generates is only a single page.
>>>> it's not impossible to upgrade but i'd rather not rightnow if i can 
>>>> help it. i'd preffer to just get it working
>>>> _______________________________________________
>>>
>>>
>>>
>>> .... the current version at least generates all the older tests in 
>>> tables.pdf.
>>> This definitely contains lots of splitting. Your example looks fine, 
>>> but it doesn't and I'm not going to switch back to 1.19 just now.
>>
>>
>>
>> do you know if splitting was possible in 1.19
>> i've been thinking of upgrading anyway since 2 contains cool new 
>> features. i might just do it and see what happens
>
>
> i upgraded to 1.2 but still the same problem. it appear using my 
> example it's not possible to create a single table that spans 2 pages
> _______________________________________________

i got no answer so i'm going to try again.
can anyone post their reportlab version and a working example of multi 
page tables. i'd like to compare it to mine and see what's going on.
the problems gotten more critical now. the strange thing is i make multi 
page tables else where without a problem.

here is my code:
doc = SimpleDocTemplate(PDFName,pagesize=landscape(A4)
   
    #this fetchs figures from the database and returns them in a list of 
lists
    Data = PaperWorkSQL.MakeReport(UserName,PassWord, ForVenue, 
FromWeek, ToWeek, ReportType, Year)

    Report = []
   
    if ReportType == 'SecretShopper':
       #the 2 important lists
        Items = Data[0]
        Totals = Data[1]

           
        # add headings
        Report.append(Paragraph(ForVenue+ ' ' + str(Year) + ' Secret 
Shopper', TopHeadingStyle))
        Totals.insert(0,['Week','Pass/Fail','Result','Possible','Passing'])
        Items.insert(0,['Week','Category','Comment','Score'])   
       
        #items table       
        ItemsTable = Table(Items, None, None)
        Report.append(ItemsTable)   
       
        #totals table       
        TotalsTable = Table(Totals, None, None)
        Report.append(TotalsTable)   
  
       
    doc.build(Report)
  

And here is the big fat error i gt when i attemp to make a table longer 
then the page:
 File 
"/usr/local/lib/python2.3/site-packages/reportlab/platypus/tables.py", 
line 150, in __init__
    raise ValueError, "%s data error - %d columns in data but %d in 
grid" % (self.identity(),ncols, len(colWidths))
  File 
"/usr/local/lib/python2.3/site-packages/reportlab/platypus/tables.py", 
line 192, in identity
    cv = self._cellvalues
AttributeError: Table instance has no attribute '_cellvalues'

Here is my actual tables:
Table(
 rowHeights=[None, None, None, None, None, None, None, None, None, None, 
None, None, None, None, None, None, None, None, None, None],
 colWidths=[None, None, None, None],
[['Week', 'Category', 'Comment', 'Score'],
   [38, 'On arrival', 'Yes, I felt very welcomed and met the manager', 5],
   [38, 'Room', 'Very clean, cleaned regularly', 5],
   [38, 'Toilets', 'Very clean at all times', 4],
   [38, 'Wait/floor staff', 'Were very courteous, friendly and made 
conversations', 7],
   [38, 'Atmosphere', 'The whole room felt great, everyone seemed to be 
having fun', 8],
   [38, 'Friendly bar staff', 'Very friendly, happy, having fun, very 
confident', 4],
   [38, 'Volume of music', 'There was a great mix all around the venue', 4],
   [38, 'Table cleanliness', 'Cleaned very regularly - very clean', 4],
   [38, 'Speed of Service', 'Was served very quickly', 4],
   [38, 'Visual entertainment', 'Yes they were very entertaining', 4],
   [39, 'Table cleanliness', 'Cleaned very regularly - very clean', 4],
   [39, 'Speed of Service', 'Was served very quickly', 4],
   [39, 'Friendly bar staff', 'Very friendly, happy, having fun, very 
confident', 4],
   [39, 'On arrival', "I felt very welcomed but didn't meet the 
manager", 3],
   [39, 'Visual entertainment', 'Yes they were very entertaining', 4],
   [39, 'Room', 'Very clean, cleaned regularly', 5],
   [39, 'Toilets', 'Very clean at all times', 4],
   [39, 'Wait/floor staff', 'Were very courteous, friendly and made 
conversations', 7],
   [39, 'Atmosphere', 'The whole room felt great, everyone seemed to be 
having fun', 8]]
) # end table

Table(
 rowHeights=[None, None, None, None, None, None, None],
 colWidths=[None, None, None, None, None],
[['Week', 'Pass/Fail', 'Result', 'Possible', 'Passing'],
   [38, 'PASS', <PgNumeric instance - precision: 2 scale: 0 value: 37>, 
<PgNumeric instance - precision: 2 scale: 0 value: 37>, <PgNumeric 
instance - precision: 2 scale: 0 value: 33>],
   [38, 'PASS', <PgNumeric instance - precision: 2 scale: 0 value: 8>, 
<PgNumeric instance - precision: 2 scale: 0 value: 8>, <PgNumeric 
instance - precision: 2 scale: 0 value: 5>],
   [38, 'PASS', <PgNumeric instance - precision: 2 scale: 0 value: 49>, 
<PgNumeric instance - precision: 2 scale: 0 value: 49>, <PgNumeric 
instance - precision: 2 scale: 0 value: 41>],
   [39, 'PASS', <PgNumeric instance - precision: 2 scale: 0 value: 35>, 
<PgNumeric instance - precision: 2 scale: 0 value: 37>, <PgNumeric 
instance - precision: 2 scale: 0 value: 33>],
   [39, 'PASS', <PgNumeric instance - precision: 2 scale: 0 value: 8>, 
<PgNumeric instance - precision: 2 scale: 0 value: 8>, <PgNumeric 
instance - precision: 2 scale: 0 value: 5>],
   [39, 'PASS', <PgNumeric instance - precision: 2 scale: 0 value: 43>, 
<PgNumeric instance - precision: 2 scale: 0 value: 49>, <PgNumeric 
instance - precision: 2 scale: 0 value: 41>]]
) # end table





More information about the reportlab-users mailing list