[reportlab-users] keepWithNext causing first page to be blank

Adam Patt apatt at simplegeek.net
Mon Mar 2 00:05:43 EST 2009


I have two paragraphs and then a really long table that spans multiple pages. I set keepWithNext=True for the first two paragraph parts, but when I render the page, it will create the first page as blank and start on the second page. How do I keep this from happening? If I can't keep it from happening, is there a way for me to remove the first page before I write to disk?

the code is something like

doc = SimpleDocTemplate(filename, leftMargin=qinch,rightMargin=qinch,topMargin=qinch,bottomMargin=qinch)
styles = getSampleStyleSheet()
Story = []
text = Paragraph("Schedule", styles['Heading1'])
text.keepWithNext = True
Story.append(text)

data = <very large table here that goes off the page>
t = Table(data, repeatRows=1, repeatCols=1)
Story.appen(t)
doc.pagesize = landscape(LETTER)
doc.build(Story)

If I don't use keepWithNext, the table will be pushed to the next page and if I don't have the text there, the table starts on the first page just fine. Is there some mystery object I need to set the keepWithNext on that would go before my first bit of text?



No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.557 / Virus Database: 270.11.3/1974 - Release Date: 2/26/2009 2:51 PM



More information about the reportlab-users mailing list