[reportlab-users] Long table on multi pages

Marc Stober reportlab-users@reportlab.com
Mon, 7 Jul 2003 09:17:36 -0400


Hi Francois,

You have to ask a table to split itself by calling certain methods. The
usual way to do this is to use Platypus, which does this for you. For
example:

# Add the following at the top of your code:
from reportlab.platypus import SimpleDocTemplate

# Replace the last 2 lines of your code with:
doc = SimpleDocTemplate("testPlatypus.pdf")
doc.build(story)

--
Marc Stober
mstober@dalbar.com


> -----Original Message-----
> From: =?iso-8859-1?Q?Fran=E7ois_Heredero_-_Top_Music_SA?= 
> <fheredero@topmusic.ch>
> To: <reportlab-users@reportlab.com>
> Date: Fri, 4 Jul 2003 16:19:59 +0200
> Subject: [reportlab-users] Long table on multi pages
> Reply-To: reportlab-users@reportlab.com
> 
> Hello,
> 
> I have a document with a long table. If the table fits in 1 page, no
> problem. But if the table is too long for 1 page, I don't 
> have it in my page
> ?
> On reportlab documentation, I can read :
> 	Chapter 7 : "They can split across pages if needed (see 
> the canSplit
> attribute)"
> But I've don't see the 'canSplit' attribut...
> 
> Any idea ?
> Francois
> 
> 
> #!/usr/bin/python
> from reportlab.lib.units import mm
> from reportlab.pdfgen.canvas import Canvas
> from reportlab.platypus import Frame, Table
> 
> table = []
> for n in range(60):
> 	table.append(["Test %d" % (n)])
> 
> c = Canvas("test.pdf")
> f = Frame(15*mm, 15*mm, (210-2*15)*mm, 
> (297-2*15)*mm,showBoundary=1)story =
> [Table(table)]
> 
> f.addFromList(story,c)
> c.save()