How to get JasperReports groups to start work on a new page only when necessary?

I use JasperReports and iReport (PDF output) and I have a problem with a specific report:

Inside the report, I defined a group. On average, each “instance” of this group contains only a small number of detail lines, so I do not want each of them to start work on a new page, since this would be a waste of paper (the output is printed on paper).

But, on the other hand, I do not want the group to start on one page and end on the next. For example, if on page 1 I can fit in the first two groups and half of the third group, I want the entire third group to start on page 2, etc.

Is there any way to do this?

+5
source share
4 answers

The "group" property keepTogether and isStartNewPage solves your problem and combines the result of the group and always starts a new group from a new page.

<group name="CITY" isStartNewPage="true" keepTogether="true">
  <groupExpression><![CDATA[$F{CITY}]]></groupExpression>
   <groupHeader>
    ...
  </groupHeader>
</group>
+9
source

The property <group> keepTogetherdoes exactly what you want! This has been added around Jasper 3.6.2, see this discussion .

So:

<group name="CITY" keepTogether="true">
  <groupExpression><![CDATA[$F{CITY}]]></groupExpression>
  <groupHeader>
  ...
  </groupHeader>
</group>
+6
source

. , .

,

0

To display group data on a new page in the Table component, we need to set the following properties.

  • On the right side of the group name → Advanced properties → select the new page as true.
  • watch the exit, group data is displayed on a new page.

Hi,

Harish

0
source

All Articles