iReport subreport divided by a page break

2019-02-14 14:52发布

问题:

The subreport has two Detail bands, the first is "Title" and the second is another subreport. These bands are divided from each other on two pages.

I tried a lot of properties without result as "ignore pagination" and "split allowed"

My question is: How can I force ireport not to split my subreport on two pages ?

I have some screenshots:

The master report:

The subreport:

Another subreport:

The resulting pdf file looks like this:

回答1:

Instead of using two bands in the principle subreport, put the title and the second subreport into the same band. Then set the splitType for that single band to "Prevent". That way, the title and data will be kept together and the split will happen before the title if the data will not fit on the page.

Edit - Preventing the title from repeating:

Putting the title into the detail band will make it repeat with each set of data. To prevent this, change the printWhenExpression to $V{REPORT_COUNT} == 1. This will cause it to be printed only once, for the first record, and not for each subsequent loop through the datasource.