views:

23

answers:

1

Hi,

I'm using Jasper 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?

Thanks, Malki.

A: 

The property "keepTogether" does exactly what you want! It was added in around Jasper 3.6.2, see this discussion:

http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=67858

So:

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