BIRT’s standard options for page breaking is to set a page break interval on a table, set a before/after page break on groups, and to set before after page breaks on report items. But what if you want to set a page break after every 2, 3, etc. groups? One way is to create an interval group surrounding your group you’d like 2 or 3 of and page break after it. Say you choose this approach and your 2nd or 3rd group goes a couple lines over your page size. You wrap the last group to the next page for a couple lines and then the interval group page brake happens and you waste a good portion of a page.
Another way to handle this is to use script to force page breaks after every 2 groups by incrementing a variable keeping track of the groups per page. You can also keep track of the items in the group using an aggregation. If the rows in the 2 groups you had planned to put on one page go over the predetermined amount of rows a page can hold, you can manually force a page break between the two groups in the group’s onCreate method with the code this.getStyle().pageBreakBefore = “always”. If they will both fit, you’d set a page break after the 2nd group with the code, this.getStyle().pageBreakAfter = “always”. In your onPageBreak script for your group, you’d reset your count variables for the groups and for the rows. This would mean that if after you force the page break, your group/row counts would start over on the next page.
Another thing you could do would be to only keep track of the rows in a group. If 3 groups fit on one page, you wouldn’t have to force a page break until before the 4th group. Then, if only two fit on the next page, your manual row count would let you know and you’d be able to page break before the 6th group, giving you a manual interval and no splitting of groups between pages, unless a single group spanned more than one page.
Also, when using the standard “page break interval” feature on a table, group headers are not counted in the row count for a page, just the detail rows. If you kept a manual count of rows, including the group header rows, you could use the pageBreakBefore script above in your row’s onCreate script to manually page break when you’ve reached your maximum lines that can fit on a page.
A simple example showing how to do the manual interval group of groups can be found in the devShare at the link below.
https://www.birt-exchange.org/devshare/designing-birt-reports/1186-manual-group-page-breaks/#description
Custom/Dynamic Page Breaking in BIRT
BIRT’s standard options for page breaking is to set a page break interval on a table, set a before/after page break on groups, and to…
OpenText
March 24, 2010•3 minute read
OpenText
OpenText, The Information Company, enables organizations to gain insight through market-leading information management solutions, powered by OpenText Cloud Editions.
See all postsMore from the author
All we want for Christmas: An open letter to Santa from a modern legal team
As legal professionals embracing digital transformation, our wish list is a bit different this year.
December 11, 2024 • 4 minute read
OpenText Intelligence Aviator: Your data’s new best friend
Creating a data-driven culture within enterprises is a challenge.
November 19, 2024 • 3 minute read
Supercharge Your Data Strategy with the Latest Insights on Data and AI
Introducing the 2024 CXO Insights Guide on Data & AI Guide
October 31, 2024 • 6 minute read