JasperReports: counting pages depending on group

2019-06-07 05:36发布

问题:

The problem is like this.

The report page numbers that are displayed on the page should not be dependent on the current but on the group page.

Let me explain:

I have a report with 2 groups that has 4 pages, each group on two pages, and what I need to do is the following:

group 1 page 1: should be: 1/2 -> current: 1/4
group 1 page 2: should be: 2/2 -> current: 2/4
group 1 page 1: should be: 1/2 -> current: 3/4
group 1 page 2: should be: 2/2 -> current: 4/4

Is there any way this can be done ...

PS. No black magic allowed, I had a look at the variables that are defined in JasperReports but none of them fit the profile :)

回答1:

You could try setting setting the isResetPageNumber attribute of the group to true.

e.g. <group name="someGroupName" isResetPageNumber="true" >



回答2:

user51931 answer is correct ! It also helpful to me.

You can also set this group property from design view.