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 profile picture

OpenText

March 24, 20103 minutes read

Descriptive text explaining the contents of the image.

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.
http://www.birt-exchange.org/devshare/designing-birt-reports/1186-manual-group-page-breaks/#description

Share this post

Share this post to x. Share to linkedin. Mail to
OpenText avatar image

OpenText

OpenText, The Information Company, enables organizations to gain insight through market-leading information management solutions, powered by OpenText Cloud Editions.

See all posts

More from the author

How Pick n Pay plans to transform software test cases with AI

How Pick n Pay plans to transform software test cases with AI

Beta tester reports OpenText DevOps Aviator delivers fast, accurate results

April 5, 2024 5 minutes read
Manutan combines digital services with the human touch to delight customers

Manutan combines digital services with the human touch to delight customers

At Manutan, we equip businesses and communities with the products and services they require to succeed. Headquartered in France, our company has three divisions, serving…

January 31, 2024 4 minutes read
Reaching new markets in Europe and beyond

Reaching new markets in Europe and beyond

How information management specialists at One Fox slashed time to market for innovative products with OpenText Cloud Platform Services At One Fox, we’ve driven some…

January 18, 2024 4 minutes read

Stay in the loop!

Get our most popular content delivered monthly to your inbox.