how to display data less than 5 row in jasper reports - jasper-reports

I have created a report table. I have set it to display 5 rows of data per page. The problem now is when there are less than 5 rows of data the table will not appear.
I have put $V{REPORT_COUNT} %5 == 0 in every section.
How can I modify this formula so that the data rows will display even though there are less than 5 rows?

Sorry that I couldn't reply earlier, as I'd a busy day at work. After looking at your report design, I found that 'Page Break' functionality is not something that you really need. I just changed the Group Expression for the group that you have, to : $F{PARENT_NAME} +
(($V{REPORT_COUNT} % 5 == 0) ? "1" : "2") and set the 'Start on new page' parameter to true. Also, I changed the Chart data. Check the below jrxml data:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ChartLineBless" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="P_YEAR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="P_AGENCY_CODE" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="P_SECTOR_LOOK_CODE" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<field name="PARENT_NAME" class="java.lang.String"/>
<field name="PARENT_NAME_SECTOR" class="java.lang.String"/>
<field name="AGENCY_PARENT_CODE" class="java.lang.String"/>
<field name="AGENCY_CODE" class="java.lang.String"/>
<field name="AGENCY_NAME" class="java.lang.String"/>
<field name="YEAR" class="java.lang.String"/>
<field name="SECTOR_ID" class="java.lang.String"/>
<field name="SECTOR_NAME" class="java.lang.String"/>
<field name="DYEAR1" class="java.math.BigDecimal"/>
<field name="DYEAR2" class="java.math.BigDecimal"/>
<field name="DYEAR3" class="java.math.BigDecimal"/>
<field name="DYEAR4" class="java.math.BigDecimal"/>
<field name="DYEAR5" class="java.lang.String"/>
<field name="YR1" class="java.math.BigDecimal"/>
<field name="YR2" class="java.math.BigDecimal"/>
<field name="YR3" class="java.math.BigDecimal"/>
<field name="YR4" class="java.math.BigDecimal"/>
<field name="YR5" class="java.math.BigDecimal"/>
<variable name="YR1_1" class="java.math.BigDecimal" resetType="Group" resetGroup="agensi" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}]]></variableExpression>
</variable>
<variable name="YR2_1" class="java.math.BigDecimal" resetType="Group" resetGroup="agensi" calculation="Sum">
<variableExpression><![CDATA[$F{YR2}]]></variableExpression>
</variable>
<variable name="YR3_1" class="java.math.BigDecimal" resetType="Group" resetGroup="agensi" calculation="Sum">
<variableExpression><![CDATA[$F{YR3}]]></variableExpression>
</variable>
<variable name="YR4_1" class="java.math.BigDecimal" resetType="Group" resetGroup="agensi" calculation="Sum">
<variableExpression><![CDATA[$F{YR4}]]></variableExpression>
</variable>
<variable name="YR5_1" class="java.math.BigDecimal" resetType="Group" resetGroup="agensi" calculation="Sum">
<variableExpression><![CDATA[$F{YR5}]]></variableExpression>
</variable>
<group name="agensi" isStartNewPage="true" minHeightToStartNewPage="550">
<groupExpression><![CDATA[$F{PARENT_NAME} +
(($V{REPORT_COUNT} % 5 == 0) ? "1" : "2")]]></groupExpression>
<groupHeader>
<band height="98">
<textField>
<reportElement x="332" y="84" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="247" y="84" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="43" y="71" width="204" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Agency Name]]></text>
</staticText>
<staticText>
<reportElement x="10" y="71" width="33" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[No.]]></text>
</staticText>
<textField>
<reportElement x="417" y="84" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR3}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="247" y="71" width="425" height="13"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Year]]></text>
</staticText>
<staticText>
<reportElement x="672" y="71" width="85" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total]]></text>
</staticText>
<textField>
<reportElement x="587" y="84" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR5}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="502" y="84" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR4}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="22" width="802" height="26"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[5 YEAR STATISTICS ON APPLICATION RECEIVED (BY ALL AGENCIES)]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="208">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} % 5 == 0]]></printWhenExpression>
<textField>
<reportElement x="672" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[new Integer($V{YR1_1}.intValue() + $V{YR2_1}.intValue()+
$V{YR3_1}.intValue()+ $V{YR4_1}.intValue())+ $V{YR5_1}.intValue()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="10" y="0" width="237" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[ Total]]></text>
</staticText>
<textField>
<reportElement x="587" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR5_1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="502" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR4_1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="417" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR3_1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="332" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR2_1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="247" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR1_1}]]></textFieldExpression>
</textField>
<lineChart>
<chart>
<reportElement x="144" y="34" width="549" height="173"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Page"/>
<categorySeries>
<seriesExpression><![CDATA["YEAR1"]]></seriesExpression>
<categoryExpression><![CDATA[$F{DYEAR1}]]></categoryExpression>
<valueExpression><![CDATA[$V{YR1_1}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Year2"]]></seriesExpression>
<categoryExpression><![CDATA[$F{DYEAR2}]]></categoryExpression>
<valueExpression><![CDATA[$V{YR2_1}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["YEAR3"]]></seriesExpression>
<categoryExpression><![CDATA[$F{DYEAR3}]]></categoryExpression>
<valueExpression><![CDATA[$V{YR3_1}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["YEAR4"]]></seriesExpression>
<categoryExpression><![CDATA[$F{DYEAR4}]]></categoryExpression>
<valueExpression><![CDATA[$V{YR4_1}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["YEAR5"]]></seriesExpression>
<categoryExpression><![CDATA[$F{DYEAR5}]]></categoryExpression>
<valueExpression><![CDATA[$V{YR5_1}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot>
<plot/>
</linePlot>
</lineChart>
<break>
<reportElement x="0" y="206" width="802" height="1"/>
</break>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="43" y="0" width="204" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="247" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="332" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="417" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR3}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="502" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR4}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="587" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR5}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="10" y="0" width="33" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="672" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[new Integer($F{YR1}.intValue() + $F{YR2}.intValue()+ $F{YR3}.intValue()+ $F{YR4}.intValue())+ $F{YR5}.intValue()]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="23">
<textField evaluationTime="Report">
<reportElement x="445" y="3" width="40" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="365" y="3" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
</band>
</columnFooter>
</jasperReport>

What you can do is to create a dummy group with 'minHeightToStartNewPage' property set to something like 700/800 (depends on your report design) for 'portrait' and 500/550 (depends on your report design) for 'Landscape' setup. You can then set the value of printWhenExpression for this dummy group as '$V{REPORT_COUNT} % 5 == 0'.
NOTE: If the value of minHeightToStartNewPage is not set correctly (more than the length of page), it can run into infinite loop problems.

Related

How to prevent joining values in Row Group (column) of Crosstab?

Is there a way to unmerge cells with the same value in crosstab?
The problem is that same valued cells are getting merged.
I want the value to be repeated and have cell borders. For example, in a row group, if i have 2 columns, col1 with values 'abc' and col2 with values 1,2,3 and if there are 3 rows, the col1 is one big cell with 'abc' printed only once.
This is what I don't want and instead want it to be printed 3 times.
This is presentation I required:
Currently I have:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a53b72b8-0dda-468b-bffd-3e28d792a2d6">
<style name="Crosstab_CH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CG" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CT" mode="Opaque" backcolor="#005FB3">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<queryString>
<![CDATA[select * from test]]>
</queryString>
<field name="col1" class="java.lang.String"/>
<field name="col2" class="java.lang.Integer"/>
<field name="col3" class="java.lang.String"/>
<field name="col4" class="java.lang.Integer"/>
<field name="col5" class="java.lang.Integer"/>
<summary>
<band height="214" splitType="Stretch">
<crosstab>
<reportElement x="0" y="0" width="555" height="214" uuid="a8663f8c-217c-4ef3-ab2c-a11120aea80e"/>
<rowGroup name="col11" width="60">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{col1}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="6e0cb2ba-ea94-4b5e-a774-3092f6b0bd06"/>
<textFieldExpression><![CDATA[$V{col11}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="4787314d-3cb1-4f29-99d4-1443453e5d1b"/>
<text><![CDATA[Total col11]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<rowGroup name="col21" width="60">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{col2}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="bf3d5e77-12a9-44cc-94d1-3f2a317f32d1"/>
<textFieldExpression><![CDATA[$V{col21}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="c21bf242-edbb-4533-9d7d-7120282703a5"/>
<text><![CDATA[Total col21]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="col31" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{col3}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<textField>
<reportElement x="0" y="0" width="120" height="20" uuid="320dded3-882b-4e8d-a821-ce94996a72d2">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textFieldExpression><![CDATA[$V{col31}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="e78a53ad-4437-41d1-8cea-ab1a2fdf09d3"/>
<text><![CDATA[Total col31]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="col4_MEASURE1" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{col4}]]></measureExpression>
</measure>
<measure name="col5_MEASURE1" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{col5}]]></measureExpression>
</measure>
<crosstabCell width="120" height="20">
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="ddc2801e-7492-4848-b7f7-422d7267cadb"/>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="60" y="0" width="60" height="20" uuid="38136ac4-94aa-46ef-91ca-b32ac1d19aba">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="col31">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="0b620468-123a-434e-8a87-be8125b86470"/>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="d3c3da1b-7c66-48e5-8328-9c775e036229"/>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="col11">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="08db97ef-0f91-4301-a552-2eec171c2b91"/>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="2fa36822-c633-4954-b6ad-bb2633dd827b"/>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="col11" columnTotalGroup="col31">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="a1545b3f-ac13-4e97-8720-3b526af18207"/>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="02c1d1d7-8b20-461e-8bd9-b2e4ceff02ed"/>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="col21">
<cellContents mode="Opaque" style="Crosstab_CG">
<textField>
<reportElement x="0" y="0" width="60" height="10" uuid="94b61c57-3b18-4134-a48f-36394cf8ac28"/>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" uuid="b8b84ab6-a800-427e-8738-40dc17f8b7ae"/>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="col21" columnTotalGroup="col31">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="e34172fb-29af-43aa-af6b-50bb63949236"/>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="232ba479-f365-4fb8-8402-4a9d50f79c6c"/>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
The col1 and col2 in your sample are Rows Groups. This name (Row Group) tell us that JasperReports engine unions all non unique values in groups in case using Crosstab component. That is why values should be always ordered for grouping data right (as shown at image below).
The data in Row Groups will be grouped by JR engine and one group is drawing as one cell.
Does this mean that the problem has no solution? - No. Let's solve it!
Looks like you want "to join" col1 and col2 columns values. This means that the value of col1 Row Group can be added to the "column" of col2 Row Group.
Example
Datasource
It is enough to test sample with simple csv datasource.
col1,col2,col3,col4,col5
abcd,1,b,1c,434
abcd,2,c,2c,333
abcd,3,c,4c,333
abcd,3,c,4c,333
abcd,5,c,4c,333
abcd,3,e,3g,909
The name of data adapter for this datasource in the example below is values.csv. The first line from the file is skipped - it is contains the column's name.
Report template
We should set the width of first column (col1 Row Group) as zero and increase the width of second column (col2 Row Group) to place additionally value of col1. In this case the JR engine draws both both values for each unique col2 value. We still need the first column because we need value of col1 (the bucket for col1 Row Group).
The design in Jaspersoft Studio (JSS) looks like:
The jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Crosstab. Merged values" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="values.csv"/>
<style name="Crosstab_CH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<field name="col1" class="java.lang.String"/>
<field name="col2" class="java.lang.Integer"/>
<field name="col3" class="java.lang.String"/>
<field name="col4" class="java.lang.Integer"/>
<field name="col5" class="java.lang.Integer"/>
<summary>
<band height="214" splitType="Stretch">
<crosstab>
<reportElement x="0" y="0" width="555" height="214"/>
<crosstabHeaderCell>
<cellContents style="Crosstab_CH">
<staticText>
<reportElement x="0" y="0" width="60" height="20"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Col1]]></text>
</staticText>
<staticText>
<reportElement x="60" y="0" width="60" height="20"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Col2]]></text>
</staticText>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="col11" width="0">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{col1}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH"/>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<rowGroup name="col21" width="120">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{col2}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="60" height="20"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textFieldExpression><![CDATA[$V{col11}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="60" y="0" width="60" height="20"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textFieldExpression><![CDATA[$V{col21}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="col31" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{col3}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="120" height="20"/>
<textFieldExpression><![CDATA[$V{col31}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="col4_MEASURE1" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{col4}]]></measureExpression>
</measure>
<measure name="col5_MEASURE1" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{col5}]]></measureExpression>
</measure>
<crosstabCell width="120" height="20">
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="60" height="20"/>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textFieldExpression><![CDATA[$V{col4_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="60" y="0" width="60" height="20"/>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textFieldExpression><![CDATA[$V{col5_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
Output result
The result in JSS:

Jasper report export to RTF not working correctly

I am using jrxml to export to RTF format.
When number of columns are 12 it is working fine otherwise if we increase number of columns view seems distorted.
When I exported with 10 columns it looks perfectly fine.
I am new to this could anyone help me in this case.
jrxml template used:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="PSDefaultPointAndClick" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20">
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
<property name="ireport.zoom" value="1.4641000000000006"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<parameter name="system.REPORT_NAME" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["Default Report"]]></defaultValueExpression>
</parameter>
<parameter name="config.SUPPORTED_FORMATS" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["HTML,PDF,EXCEL,EXCEL_2007,RTF,CSV,POWERPOINT_2007"]]></defaultValueExpression>
</parameter>
<parameter name="config.FOR_INTERNAL_USE" class="java.lang.String" isForPrompting="false"/>
<parameter name="system.REPORT_FOOTER" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["Copyright (c) 2007,"]]></defaultValueExpression>
</parameter>
<parameter name="config.DATASOURCE" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["PointAndClick"]]></defaultValueExpression>
</parameter>
<parameter name="system.RUN_BY_AND_ON_INFO" class="java.lang.String" isForPrompting="false"/>
<parameter name="system.GENERATION_DATE" class="java.lang.String" isForPrompting="false"/>
<parameter name="system.USER_NAME" class="java.lang.String" isForPrompting="false"/>
<parameter name="system.PAGE" class="java.lang.String" isForPrompting="false"/>
<parameter name="system.EXPORT_FORMAT" class="java.lang.String" isForPrompting="false"/>
<field name="work_id" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="owner" class="java.lang.String"/>
<field name="owner_id" class="java.lang.String"/>
<field name="status_current" class="java.lang.String"/>
<field name="active_gate" class="java.lang.String"/>
<field name="active_gate_id" class="java.lang.String"/>
<group name="level1">
<groupExpression><![CDATA[]]></groupExpression>
<groupHeader>
<band height="16" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-12" stretchType="RelativeToBandHeight" mode="Opaque" x="54" y="0" width="341" height="16" backcolor="#EBEBEB"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement verticalAlignment="Bottom">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Group Level 1 "]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-22" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="395" height="16" backcolor="#FFFFFF"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement>
<font fontName="Arial" isBold="true" isItalic="false" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Summary Level 1 "]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<group name="level2">
<groupExpression><![CDATA[]]></groupExpression>
<groupHeader>
<band height="16" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-13" stretchType="RelativeToBandHeight" mode="Opaque" x="99" y="0" width="296" height="16" backcolor="#EBEBEB"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement verticalAlignment="Bottom">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Group Level 2 "]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-21" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="395" height="16" backcolor="#FFFFFF"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement>
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Summary Level 2 "]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<group name="level3">
<groupExpression><![CDATA[]]></groupExpression>
<groupHeader>
<band height="16" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-14" stretchType="RelativeToBandHeight" mode="Opaque" x="158" y="0" width="237" height="16" backcolor="#EBEBEB"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement verticalAlignment="Bottom">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Group Level 3 "]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-20" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="395" height="16"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement>
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Summary Level 3 "]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="16" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-4" stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="0" width="395" height="16" backcolor="#E7EFF7"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="1.0" lineColor="#FFFFFF"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="1.0" lineColor="#FFFFFF"/>
</box>
<textElement verticalAlignment="Bottom">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["ColumnTitle"]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="16" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-11" stretchType="RelativeToBandHeight" mode="Opaque" x="235" y="0" width="160" height="16"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2"/>
<textElement>
<font fontName="Arial" isBold="false" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Even_Row"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-16" stretchType="RelativeToBandHeight" mode="Opaque" x="395" y="0" width="140" height="16" backcolor="#FCFAF6"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2"/>
<textElement>
<font fontName="Arial" isBold="false" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Odd_Row"]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-17" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="395" height="16"/>
<box topPadding="1" leftPadding="2" bottomPadding="1" rightPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement>
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Column Summary"]]></textFieldExpression>
</textField>
</band>
</columnFooter>
<pageFooter>
<band height="42" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement key="textField-26" mode="Opaque" x="0" y="6" width="58" height="36" backcolor="#F5F5F5"/>
<box topPadding="3" bottomPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{system.PAGE} + " " + $V{PAGE_NUMBER} + " /"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report" isBlankWhenNull="false">
<reportElement key="textField-27" mode="Opaque" x="58" y="6" width="59" height="36" backcolor="#F5F5F5"/>
<box topPadding="3" bottomPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="Arial" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="textField-28" mode="Opaque" x="117" y="6" width="418" height="36" backcolor="#F5F5F5"/>
<box topPadding="3" bottomPadding="2" rightPadding="9">
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{system.REPORT_FOOTER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<lastPageFooter>
<band height="38" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement key="textField-23" mode="Opaque" x="0" y="2" width="58" height="36" backcolor="#F5F5F5"/>
<box topPadding="3" bottomPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{system.PAGE} + " " + $V{PAGE_NUMBER} + " /"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report" isBlankWhenNull="false">
<reportElement key="textField-24" mode="Opaque" x="58" y="2" width="59" height="36" backcolor="#F5F5F5"/>
<box topPadding="3" bottomPadding="2">
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="Arial" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="textField-25" mode="Opaque" x="117" y="2" width="418" height="36" backcolor="#F5F5F5"/>
<box topPadding="3" bottomPadding="2" rightPadding="9">
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" pdfFontName="Helvetica" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{system.REPORT_FOOTER}]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>
<summary>
<band height="16" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-18" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="535" height="16"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#FFFFFF"/>
</box>
<textElement>
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Root Summary"]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>
JRXML file:
https://www.dropbox.com/s/l866uv4z7sccf2c/12columns.jrxml?dl=0
You cannot create an RTF document with a page size larger than 22 inch.
Your report template has a width of 23.11 inches.
The best explanation I could find is here.

How to display one group per page using Jasper Reports?

I'm using iReport to create a Jasper Report template, and I need to display one group per page:
Group 1: (Page One)
-Field1 Field2 Field3
Group 2: (Page Two)
-Field1 Field2 Field3
And so on.
I tried setting the Maximize Band Height property to true in the "Group Footer" band using iReport, but some empty pages are added when I try to review.
You can use isStartNewPage attribute of group.
You can add Group Header band and
1) set "Start on a new page" attribute as true
2) set band height as 0 (if you don't need it).
The working sample
The jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="group_break" language="groovy" pageWidth="400" pageHeight="400" columnWidth="360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2bcb6f3d-2169-44f6-9e8a-db54ea21b5e0">
<queryString>
<![CDATA[SELECT DOCUMENTID, PRODUCTID, PRICE FROM POSITIONS ORDER BY DOCUMENTID]]>
</queryString>
<field name="DOCUMENTID" class="java.lang.Integer"/>
<field name="PRODUCTID" class="java.lang.Integer"/>
<field name="PRICE" class="java.math.BigDecimal"/>
<group name="docId" isStartNewPage="true">
<groupExpression><![CDATA[$F{DOCUMENTID}]]></groupExpression>
<groupHeader>
<band/>
</groupHeader>
</group>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="111" height="20" uuid="596f5fb4-7e6d-4e7e-88bf-b9c37d0fb1a1"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Position]]></text>
</staticText>
<staticText>
<reportElement x="111" y="0" width="111" height="20" uuid="4884f663-00cf-4b5f-9cc1-05d698b8154a"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Id]]></text>
</staticText>
<staticText>
<reportElement x="222" y="0" width="111" height="20" uuid="26c8d18f-2281-405c-a41b-bddcbcdebdbb"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Price]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="111" height="20" uuid="fb6369eb-4b92-41dd-b5b8-94a9210bf315"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{DOCUMENTID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="0" width="111" height="20" uuid="9fcbb785-06fa-4f7a-bc6d-301cc8db4388"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{PRODUCTID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="222" y="0" width="111" height="20" uuid="0d18c9fe-5a70-4890-b94d-f26d88bc97da"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{PRICE}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="50">
<textField>
<reportElement x="0" y="20" width="80" height="20" uuid="47486fe9-e21f-4913-a9c4-cef0d3e2df39"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="80" y="20" width="40" height="20" uuid="0f7df66b-bbe6-4373-962e-519584c44541"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
The result
The output result generated in iReport via preview mode

How to generate separate pages for each group? [duplicate]

This question already has an answer here:
New page for every group in iReport
(1 answer)
Closed 2 years ago.
Story:
Two Domain Objects:
class JasperProject {
private String ...
}
class JasperProjectGroup {
private String ...
private List<JasperProject> ...
}
Code for Jasper:
Map<String, Object> parameters = new HashMap<String, Object>();
List<JasperProjectGroup> groups = buildGroups();
parameters.put("groups", groups);
InputStream jasperReportInputStream = ProjectStatusReportGenerator.class.getClassLoader().getResourceAsStream(
PROJECT_STATUS_JASPER_REPORT_FILENAME);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReportInputStream, parameters,
new JREmptyDataSource());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
return outputStream.toByteArray();
I want to create a pdf report with tables which each group table on each separate page (e.g. table for group 1 on page1, table for group 2 on page2).
However, when I pass the groups as parameter to Jasper template, it display just one table contains all the groups on the pdf report.
XML code for jrxml
First xml:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="timesheets" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="groups" class="java.util.Collection"/>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="800" splitType="Stretch">
<subreport runToBottom="true">
<reportElement x="0" y="0" width="515" height="800"/>
<dataSourceExpression><![CDATA[(new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{groups}))]]></dataSourceExpression>
<subreportExpression><![CDATA[net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.class.getClassLoader().getResourceAsStream("projectgroup.jasper")]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
Second template (projectgroup.jrxml):
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="projectgroup" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="TableDataset1">
<field name="projectName" class="java.lang.String"/>
<field name="bookedHours" class="java.lang.String"/>
<field name="predictedHours" class="java.lang.String"/>
<field name="burnedHours" class="java.lang.String"/>
<field name="percentageComplete" class="java.lang.String"/>
<field name="bookedHoursBurned" class="java.lang.String"/>
</subDataset>
<field name="jasperProjectStatusReports" class="java.util.List"/>
<detail>
<band height="50" splitType="Stretch">
<subreport>
<reportElement x="0" y="0" width="515" height="50"/>
<dataSourceExpression><![CDATA[(new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{jasperProjectStatusReports}))]]></dataSourceExpression>
<subreportExpression><![CDATA[net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.class.getClassLoader().getResourceAsStream("projectgroup_table.jasper")]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
Third template xml (projectgroup_table.jasper):
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="projectgroup_table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="groupName" class="java.lang.String"/>
<field name="projectName" class="java.lang.String"/>
<field name="bookedHours" class="java.lang.String"/>
<field name="predictedHours" class="java.lang.String"/>
<field name="burnedHours" class="java.lang.String"/>
<field name="percentageComplete" class="java.lang.String"/>
<field name="bookedHoursBurned" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="20" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{groupName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="100" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Booked]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="200" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Predicted]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="300" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Burned]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="400" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Complete]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="500" y="0" width="95" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Booked Burned]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="21" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{projectName}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="100" y="0" width="100" height="20"/>
<box leftPadding="0" rightPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{bookedHours}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="200" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{predictedHours}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="300" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{burnedHours}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="400" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{percentageComplete}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="500" y="1" width="95" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{bookedHoursBurned}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Are there any ideas about that? thanks.
Yes this can be done. If you expand the detail field by using ireprt... by this when once your one group got printed there will be no space for other group, so that next group will be on next page.
Its jasper report's built-in functionality.

Repeating row for every report

I have created a table report.
I have put no, agency name, year 1, year 2, year 3, year 4, year 5 and the total for the first row and the second row. I've put all sum of year 1, year 2, year 3, year 4, year 5 and total of agencies in the Detail band. After that, I put the line chart layout. In the end, I put the page break with $V{REPORT_COUNT} % 5==0 condition. But the problem is repetitive data along both the row. How to solve this problem? I want to view 5 row per page for an one report. The result are still the same.
Here i attach my code:
Update:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="charttest" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="99"/>
<parameter name="P_YEAR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\Documents and Settings\\NT\\Desktop\\CHART\\"]]></defaultValueExpression>
</parameter>
<field name="PARENT_NAME" class="java.lang.String"/>
<field name="PARENT_NAME_SECTOR" class="java.lang.String"/>
<field name="AGENCY_PARENT_CODE" class="java.lang.String"/>
<field name="AGENCY_CODE" class="java.lang.String"/>
<field name="AGENCY_NAME" class="java.lang.String"/>
<field name="YEAR" class="java.math.BigDecimal"/>
<field name="SECTOR_ID" class="java.lang.String"/>
<field name="SECTOR_NAME" class="java.lang.String"/>
<field name="DYEAR1" class="java.math.BigDecimal"/>
<field name="DYEAR2" class="java.math.BigDecimal"/>
<field name="DYEAR3" class="java.math.BigDecimal"/>
<field name="DYEAR4" class="java.math.BigDecimal"/>
<field name="DYEAR5" class="java.lang.String"/>
<field name="YR1" class="java.math.BigDecimal"/>
<field name="YR2" class="java.math.BigDecimal"/>
<field name="YR3" class="java.math.BigDecimal"/>
<field name="YR4" class="java.math.BigDecimal"/>
<field name="YR5" class="java.math.BigDecimal"/>
<variable name="YR1_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}]]></variableExpression>
</variable>
<variable name="YR2_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR2}]]></variableExpression>
</variable>
<variable name="YR3_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR3}]]></variableExpression>
</variable>
<variable name="YR4_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR4}]]></variableExpression>
</variable>
<variable name="YR5_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR5}]]></variableExpression>
</variable>
<variable name="YR1_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}]]></variableExpression>
</variable>
<variable name="YR2_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR2}]]></variableExpression>
</variable>
<variable name="YR3_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR3}]]></variableExpression>
</variable>
<variable name="YR4_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR4}]]></variableExpression>
</variable>
<variable name="YR5_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR5}]]></variableExpression>
</variable>
<variable name="sumA" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}+$F{YR2}+$F{YR3}+$F{YR4}+$F{YR5}]]></variableExpression>
</variable>
<group name="Agency">
<groupExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></groupExpression>
<groupHeader>
<band height="192">
<textField>
<reportElement x="622" y="83" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{SECTOR_NAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="64" y="145" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{AGENCY_NAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="74" y="83" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{DYEAR1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="18" y="83" width="56" height="20"/>
<textElement/>
<text><![CDATA[Year From :]]></text>
</staticText>
<staticText>
<reportElement x="18" y="104" width="56" height="20"/>
<textElement/>
<text><![CDATA[Year To :]]></text>
</staticText>
<staticText>
<reportElement x="574" y="83" width="48" height="20"/>
<textElement/>
<text><![CDATA[Sector :]]></text>
</staticText>
<staticText>
<reportElement x="18" y="145" width="46" height="20"/>
<textElement/>
<text><![CDATA[Agency :]]></text>
</staticText>
<textField>
<reportElement x="74" y="104" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{DYEAR5}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="21" width="802" height="26"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[5 YEAR STATISTICS ON APPLICATION RECEIVED (BY ALL AGENCIES)]]></text>
</staticText>
<staticText>
<reportElement x="18" y="165" width="33" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[No.]]></text>
</staticText>
<textField>
<reportElement x="425" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR3}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="510" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR4}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="595" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR5}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="255" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="255" y="165" width="425" height="13"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Year]]></text>
</staticText>
<staticText>
<reportElement x="51" y="165" width="204" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Agency Name]]></text>
</staticText>
<staticText>
<reportElement x="680" y="165" width="85" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Total]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="395">
<lineChart>
<chart>
<reportElement x="30" y="42" width="772" height="353"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Group" resetGroup="Agency" incrementType="Report"/>
<categorySeries>
<seriesExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></seriesExpression>
<categoryExpression><![CDATA[$F{YEAR}]]></categoryExpression>
<valueExpression><![CDATA[$F{YR5}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot>
<plot/>
</linePlot>
</lineChart>
<textField>
<reportElement x="340" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR2_2}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="18" y="0" width="237" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[ Total]]></text>
</staticText>
<textField>
<reportElement x="255" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR1_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="425" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR3_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="510" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR4_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="595" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR5_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="680" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[new Integer($V{YR1_1}.intValue() + $V{YR2_1}.intValue()+
$V{YR3_1}.intValue()+ $V{YR4_1}.intValue())+ $V{YR5_1}.intValue()]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="510" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR4}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="51" y="0" width="204" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="18" y="0" width="33" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="255" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="425" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR3}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="595" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR5}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="680" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[new Integer($F{YR1}.intValue() + $F{YR2}.intValue()+ $F{YR3}.intValue()+ $F{YR4}.intValue())+ $F{YR5}.intValue()]]></textFieldExpression>
</textField>
<break>
<reportElement x="0" y="19" width="802" height="1">
<printWhenExpression><![CDATA[($V{REPORT_COUNT} % 5 == 0)]]></printWhenExpression>
</reportElement>
</break>
</band>
</detail>
</jasperReport>
If I understand you correctly, you want to have 5 detail rows followed by the graph, and then a linebreak? The reason this is not happening is because you have the linegraph printing after every detail row. So it never actually hits the 5th row. You need to move the line graph to the agnesi Group Footer 1 section.
UPDATE: If you only want the column header on the first page, then you need to add a printWhenExpression to it that has $V{PAGE_NUMBER}==1
2nd UPDATE: You have a few things wrong with your report.
One you put a page break in your Page Footer. That should not be
there. It makes does not make since to put a page break in the footer
at all.
Two You have multiple detail sections. I do not think that is going
to work the way you expect it to. The items in your Detail 2 section
more than likely be in the Agency Group Footer 1 with NO Page
Break.
Three your column header does not seem right. You are referencing
Fields in there. Fields is the data in your datasource that are
iterated over in the group and detail section. As a best Guess this
should be moved into the Agency Group Header 1 instead of the
column header.
Lastly the only place you should put a page break in your case is in
the Detail 1 section with the print when expression
($V{REPORT_COUNT} % 5) == 0
Something I find that helps me keep things clearer is to delete the sections altogether that I am not using. Once you do the things above I told you about, you could for example delete the title, page header, column header, page footer, and summary sections.