[reportlab-users] Page headings in platypus

Robin Becker robin at reportlab.com
Tue Nov 3 11:53:12 EST 2009





Robert Young wrote:



I am trying to write code that will place a "continued" heading on a

> page. I have added all the "paragraphs" to a "story" and once they are

> all added, I use the build method and can place global page headers with

> no p[problem. However, I want to add a section heading when the data

> flows on to the next page. For example, the data looks like this:

>


There is a gadget in flowables.py that attempts this sort of thing. It's called
PTOContainer and attempts to do injection of specified lists into the flow when
it is split. (PTO stands for "Please Turn Over"). Personally I hate it as it's
full of edge cases and bugs. For your case I guess you need to do something like

story.append(PTOContainer([section1flowables],header=[ContinuedSection1Flowables])

give it a whirl and see what happens.


>

> Section 1

>

> Line 1

>

> Line 2

>

> Line 3

>

> ...

>

> Line n

>

> Section 2

>

> Line 1

>

> Line 2

>

> Line 3

>

> ...

>

> Line n

>

>

>

> When a section flows on to a new page, I want to add the heading

> "Section 1 (continued)." The problem is, the pagination occurs long

> after the "story" is built, so I have no idea where the break is

> occurring, and I don't really want to hard code a break anyhow.

>

>

>

> How can I detect during the build where a break occurs, and how can I

> determine the appropriate data to print at that time? Is there such an

> attribute as a paragraph header?

>

>

.....

--
Robin Becker


More information about the reportlab-users mailing list