[reportlab-users] Page headings in platypus

Robert Young Robert at AbilitySys.com
Wed Nov 4 09:42:33 EST 2009



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



-----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 4:29 AM
To: For users of Reportlab open source software
Subject: Re: [reportlab-users] Page headings in platypus

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

> header when a paragraph is the first one on a new page.

>

> I think I can rewrite my code to put out all the lines for a group as

a

> single paragraph, and my test show that the PTOContainer gives me the

> header when the paragraph goes over a page boundary, but just for

grins,

> is there a way to generate a header when a paragraph is the first

thing

> on a page?

>

> - Robert

........

In latest reportlab there are new Programming Flowables which allow
condifitonal
execution based on the state of the current doctemplate and frame etc
etc.

I think you should be able to use something like

DocIf('string boolean expression',[thenflowables],[elseflowables])

ie


story.append(DocIf('doc.frame.atTop',[Paragraph('sectionhead...',style=h
eadingStyle)]))

prior to your lead paragraph for each section.
--
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