[reportlab-users] Page headings in platypus

Robert Young Robert at AbilitySys.com
Wed Nov 4 00:31:13 EST 2009



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

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




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=[ContinuedSection1F
lowables])

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
_______________________________________________
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