[reportlab-users] Page headings in platypus

Robert Young Robert at AbilitySys.com
Wed Nov 4 21:17:44 EST 2009



Thanks - that stopped the crash, but it doesn't actually put headers in
my report.

The code now does:

story.append(Paragraph(Group1header1,headerstyle))
story.append(DocIf('doc.frame._atTop',Paragraph(continuation1,headerstyl
e)))
story.append(Paragraph(detail line1,detailstyle))
story.append(Paragraph(detail line2,detailstyle))
story.append(Paragraph(detail line3,detailstyle))
...
story.append(Paragraph(detail line_n,detailstyle))

story.append(Paragraph(Group2header1,headerstyle))
story.append(DocIf('doc.frame._atTop',Paragraph(continuation2,headerstyl
e)))
story.append(Paragraph(detail line1,detailstyle))
story.append(Paragraph(detail line2,detailstyle))
story.append(Paragraph(detail line3,detailstyle))
...
story.append(Paragraph(detail line_n,detailstyle))

and so on. Then it does the build:

pdf.build(story, onFirstPage=BuildPage,onLaterPages=BuildPage)

(with BuildPage putting page numbers on each page.

Each detail line paragraph is only one or two lines, so it is rare that
a paragraph will break across a page. I was hoping that each "DocIf"
would put the appropriate continuation header when any of the following
detail lines is at the start of a page. Or is there some sort of
container between "paragraph" and "story" that would be better to use?

- Robert


-----Original Message-----
From: reportlab-users-bounces at lists2.reportlab.com
[mailto:reportlab-users-bounces at lists2.reportlab.com] On Behalf Of Robin
Becker
Sent: Wednesday, November 04, 2009 7:53 AM
To: For users of Reportlab open source software
Subject: Re: [reportlab-users] Page headings in platypus

Robert Young wrote:

> Actually, scratch my earlier note. I found that:

>

> from reportlab.platypus.flowables import DocIf

>

> However, with the statement:

>

> story.append(DocIf('doc.frame.atTop',headertext))

>

> gets me an error:

>

> AttributeError: atTop

> docEval doc.frame.atTop failed!

>

> Ideas?

>

> - Robert


Doh! not enough doughnuts today. Frame objects have an _atTop attribute.


> Robert Young wrote:

>> Thanks, that's (almost) exactly what I needed. My current code is

>> reading in each line, and putting each one out as a separate

>> "paragraph." Under that sort of arrangement, I want to put out the

..........
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportlab-users at lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users


More information about the reportlab-users mailing list