[reportlab-users] Splitting tables across pages and choosing templates accordingly
Jordi Gutiérrez Hermoso
jordigh at octave.org
Thu Jan 12 16:08:59 EST 2012
2012/1/5 Jordi Gutiérrez Hermoso <jordigh at octave.org>:
> 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 couldn't figure out how to do it with this method... What kind of
information is there available to know if the next flowable will fit
in the current frame without splitting, and if it does, change the
page template accordingly?
- Jordi G. H.
More information about the reportlab-users