Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make JasperReports groups start on new page only when needed?

I'm using JasperReports and iReport (output to PDF), and I have a problem with a certain report:

Inside the report I have defined a group. On average, each "instance" of that group only contains a small number of detail rows, so I don't want each of them to start on a new page, since it would be a waste of paper (the output is printed on paper).

But on the other hand, I don't want to have a group that starts on one page and ends on the next one. For example, if on page 1 I can fit the first two groups and half of the third group, I want the entire third group to start on page 2, and so on.

Is there any way to do that?

like image 597
Malki Avatar asked Jul 11 '10 11:07

Malki


1 Answers

The "group" property keepTogether and isStartNewPage will solve your problem and makes group result together and always starts new group from new page.

<group name="CITY" isStartNewPage="true" keepTogether="true">
  <groupExpression><![CDATA[$F{CITY}]]></groupExpression>
   <groupHeader>
    ...
  </groupHeader>
</group>
like image 122
Sandeep Sharma Avatar answered Oct 18 '22 16:10

Sandeep Sharma