[reportlab-users] Page headings in platypus

Robin Becker robin at reportlab.com
Wed Nov 4 07:29:25 EST 2009


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=headingStyle)]))

prior to your lead paragraph for each section.
--
Robin Becker


More information about the reportlab-users mailing list