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

5

12

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?

Ayurveda answered 11/7, 2010 at 11:30 Comment(0)
E
20

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>
Extremist answered 15/10, 2015 at 11:49 Comment(0)
R
8

The <group> property keepTogether does exactly what you want! It was added in around Jasper 3.6.2, see this discussion.

So:

<group name="CITY" keepTogether="true">
  <groupExpression><![CDATA[$F{CITY}]]></groupExpression>
  <groupHeader>
  ...
  </groupHeader>
</group>
Repeat answered 18/8, 2010 at 14:13 Comment(0)
B
1

Right Click on the detail band and Add another Detail Band. You can group your page using these detail band blocks.

Add sufficient height to each band so that it will not overlap on the new page

Balling answered 16/9, 2013 at 15:51 Comment(0)
P
0

For displaying group data in new page in Table component we need to set the following properties.

  1. Right on the group name --> Advanced properties --> select new page as true.
  2. observe the output , the group data is displayed in new page.

Regards,

Harish

Phrenology answered 12/3, 2015 at 10:47 Comment(0)
A
0

View > Report Groups > Modify > Min Heiht to Start New Page = 100

Ariadne answered 14/12, 2021 at 11:45 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Liquescent

© 2022 - 2024 — McMap. All rights reserved.