[reportlab-users] Splitting tables across pages and choosing templates accordingly

Jordi Gutiérrez Hermoso jordigh at octave.org
Thu Jan 5 15:56:49 EST 2012


2011/12/21 Jordi Gutiérrez Hermoso <jordigh at octave.org>:

> I want to write a report that has three kinds of pages: a title page,

> graph pages, and tables pages. Attached is an example of the kind of

> structure I have right now. This works fine if the tables don't need

> to be broken across pages. However, when breaking up the tables, I

> think I need two different templates for tables, a table_page_cont and

> table_page_final because the last page needs some information that the

> intermediate table pages don't.

>

> So my question is, is there a way to know if I need a new page because

> a table needs to be broken up? Then I would call

> doc.handle_nextPageTemplate with diffferent arguments if I could know

> if I'm done with the table or not. In case the table doesn't need to

> be broken up at all, this could also be useful.

>

> tl;dr: Is there a way I can know how a table will be broken up so that

> I can choose the appropriate page templates?


Following up on this, I'm seeing PageTemplate.afterDrawPage's
docstring reads:

This is called after the last flowable for the page has been
processed. You might use this if the page header or footer needed
knowledge of what flowables were drawn on this page.

Isn't this precisely what I need? I want to know if a full table has
been written on this page or not. How do I get this information? I
would expect that the doc argument passed to the PageTemplate should
know which flowables it has and which ones it has processed. How do I
find out?

Thanks,
- Jordi G. H.


More information about the reportlab-users mailing list