Search code examples
jasper-reportsgrouping

How to restrict jasper report not to start on a new page for every group?


I am new to Jasper Reports. In my project, the version being used is Jasper Reports 3.1.2. Problem is: I have a main report which displays the summary and 2 other subreports. The data is grouped on the basis of 2 fields and data is coming (already grouped) from the backend. In my jasper report, I have the following group and the following properties set:

<group name="groupName" isStartNewPage="true" isResetPageNumber="true" isReprintHeaderOnEachPage="true" >
        <groupExpression><![CDATA[$V{REPORT_COUNT}]]></groupExpression>
        <groupHeader>
        <band height="0"  isSplitAllowed="true" >
        </band>
        </groupHeader>
        <groupFooter>
        <band height="0"  isSplitAllowed="true" >
        </band>
        </groupFooter>
    </group>

Whenever a new group is seen, it prints the data on a new page. I want the data not to get printed on a new page when there is enough space on the current page to accommodate other groups data.

I have already tried removing "isStartNewPage" property. Also, tried putting "keepTogether" property, but since it is an old version of Jasper report, this property is not supported. I have tried changing the height values also, but no luck there.

I want to keep the data to one page when there is enough space to display records on a single page.

Output: The first page displays the summary data and 2 groups by which the data has been grouped. The second page shows the data of the first group which is a subreport of the first group. Similarly, there is a third page which will have the data related to the 2nd group in the summary.

Jasper Report Page 1

enter image description here

Jasper Report Page 2

enter image description here


Solution

  • this group prints the data on new page by isStartNewPage="true" property. remove this property line for prints data on current page when there is enough space on the current page.

    try with this,

    <group name="groupName" isResetPageNumber="true" isReprintHeaderOnEachPage="true" >
        .......
    </group>