[reportlab-users] platypus example

Rasha Ebo rshzky at yahoo.com
Sun Feb 26 01:05:50 EST 2006


Peace be upon you,
   
  I use the platypus example in reportlab's user guide chapter 5 page 59 to build up a Doctemplate with flowables 'paraghrap' and 'spacer' (it is used to create 100 fixed-content paraghrap with spacer between paragraphs) and it worked well then I added to this example, the code of the 'Table' follwable in page 73 chapter 7 which used a variable called 'data' to hold the data of the table (code is provided at the end)
   
  When the value of data is:
      data= [['00', '01', '02', '03', '04'],
               ['10', '11', '12', '13', '14'],
               ['10', '11', '12', '13', '14'],
               ['30', '31', '32', '33', '34']]
     and  no of the repeating the paraghraphes wsa set to 100
   , an error was raised saying:
   
  reportlab.platypus.doctemplate.LayoutError: Flowable <Table at 11499960 4 rows x 5 cols> with cell(0,0) containing '00' too large on page 13
   
  At the begining, I thought it is a problem of splitting table across multiple pages but it is not because when I changed the value of data to be:
   
      data= [['00', '01', '02', '03', '04'],
               ['10', '11', '12', '13', '14']]
  and kept the  no of the repeating the paraghraphes the same as above (100 times)
  , No error has been raised and a table was splitted perfectly across 2 pages
   
  then I changed the data value to be:
   
      data= [['00', '01', '02', '03', '04'],
               ['10', '11', '12', '13', '14'],
               ['10', '11', '12', '13', '14'],
               ['30', '31', '32', '33', '34']]
  but I changed the no of the repeating the paraghraphes to 54 or less and it works well but with 55 or more, it fails.
  And by more experiments I have found that if cut down the length of the table data and increase the repetition number of the paragraph, it can work well and viseversa
   
  Can anybody  explain to me what is the point that rules this behaviour, is it the number of charcters per page or per table cell or what?
   
  I will highlight the code line which sets the value of the table and the cosde line which determines the no of repetition
   
   I hope I have made my question clear and thanks very much for yor help
  (N.B I am a newbebi)
   
  Thanks a lot
   
  Code:
   
  platypusgo = """
def go():
    doc = SimpleDocTemplate("phello.pdf")
      Story = [Spacer(1,2*inch)]
    style = styles["Normal"] 
      data= [['00', '01', '02', '03', '04'],
               ['10', '11', '12', '13', '14'],
               ['10', '11', '12', '13', '14'],
               ['30', '31', '32', '33', '34']]
    t=Table(data)
    t.setStyle(TableStyle([('BACKGROUND',(1,1),(1,-1),green),('TEXTCOLOR',(0,0),(1,-1),red)]))
    for i in range(100):
        bogustext = ("This is Paragraph number %s.  " % i) *20
        p = Paragraph(bogustext, style)
          Story.append(p)
          Story.append(Spacer(1,0.2*inch))
        Story.append(t)
    doc.build(Story, onfiltered=myFirstPage, onfiltered=myLaterPages) #Finally build up your DocTemplate
"""
   
  #------------Execute the page code-----------------------------------
if __name__=="__main__":
    # then do the platypus hello world
    for b in platypussetup, platypusfirstpage, platypusnextpage, platypusgo:
        b = strip(b)
        print b
        exec(b+'\n')
    go()

		
---------------------------------
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060225/7ad632bc/attachment.html


More information about the reportlab-users mailing list