How to create a jasper table and textfields inside the list component with XML datasource? - jasper-reports

I am trying to generate report using Jasper iReport Designer 5.6.0, where there is a list with table and some textfields. The generated report should look like this:
To do this, I'm using the following XML file as datasource:
<report>
<subreport>
<nameOfState>USA</nameOfState>
<persons>
<person>
<dateOfBirth>1989-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Skyler White</fullName>
<address>Albuquerque 87107</address>
</person>
<person>
<dateOfBirth>1962-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Jesse Pinkman</fullName>
<address>Santa Fé 28</address>
<companies>
<company>
<nameOfCompany>Company 124</nameOfCompany>
<addressOfCompany>Santa Fé 158</addressOfCompany>
</company>
</companies>
</person>
</persons>
</subreport>
<subreport>
<nameOfState>Germany</nameOfState>
<person>
<dateOfBirth>1970-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Hank Schrader</fullName>
<address>El Paso 17</address>
<companies>
<company>
<nameOfCompany>El Paso Company</nameOfCompany>
<addressOfCompany>El Paso 28</addressOfCompany>
</company>
<company>
<nameOfCompany>COMPANY EPC</nameOfCompany>
<addressOfCompany>Santa Fé 18</addressOfCompany>
</company>
</companies>
</person>
</persons>
</subreport>
</report>
And jrxml template:
<?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="report1_subreport1" pageWidth="756" pageHeight="140" whenNoDataType="BlankPage" columnWidth="756" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error" isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">
<property name="ireport.zoom" value="1.7715610000000022"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">
<queryString language="xPath">
<![CDATA[/subreport/persons/person]]>
</queryString>
<field name="dateOfBirth" class="java.lang.String">
<fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>
</field>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">
<queryString language="xPath">
<![CDATA[/company]]>
</queryString>
<field name="nameOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
<field name="addressOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/subreport/persons/person]]>
</queryString>
<field name="nameOfState" class="java.lang.String">
<fieldDescription><![CDATA[nameOfState]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="140" splitType="Stretch">
<componentElement>
<reportElement x="0" y="36" width="753" height="104" uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="104" width="753">
<staticText>
<reportElement mode="Opaque" x="11" y="11" width="100" height="13" backcolor="#C0C0C0" uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Full name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="24" width="100" height="13" backcolor="#C0C0C0" uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address:]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="37" width="100" height="13" backcolor="#C0C0C0" uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Date of birth:]]></text>
</staticText>
<textField>
<reportElement x="112" y="11" width="239" height="13" uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="24" width="239" height="13" uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="37" width="239" height="13" uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement key="NajdenaOsobaTable1" style="table 3" stretchType="RelativeToBandHeight" mode="Transparent" x="96" y="66" width="645" height="25" isPrintWhenDetailOverflows="true" uuid="99480409-009b-4f75-b435-ad99403ddb56"/>
<jr:table whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/person/companies/company")]]></dataSourceExpression>
</datasetRun>
<jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="125" height="17" backcolor="#C0C0C0" uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Name of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="125" height="16" isPrintWhenDetailOverflows="true" uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="17" backcolor="#C0C0C0" uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="160" height="16" isPrintWhenDetailOverflows="true" uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{addressOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
<textField>
<reportElement x="12" y="10" width="100" height="20" uuid="a8753122-9817-4500-81f2-99d703df00b8"/>
<textFieldExpression><![CDATA[$F{nameOfState}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
And this is what I'm getting as resulting report (grey line is a pagebreak):
This is image what the report inspector looks like in my iReport Designer
So I am only using the detail band in this subreport.
EDIT:
List is necesarry because the data are from multiple countries, and this jrxml represent subreport which is nested in the main report.

This is all about defining your subDataset (with related fields) and XPath query in subDataSource correctly. A general indication would be query down to node, then generate subDatasource stepping back one node.
The solution in this case is to first query for the detail band (main XPath query of report)
<queryString language="XPath">
<![CDATA[/report/subreport]]>
</queryString>
This way in detail band you access you first fields nameOfState.
Then
In detail band while we are "running" on node subreport we add the jr:list component the subDataSource will be /subreport/persons/person to access the fields dateOfBirth, fullName etc.
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
and then we are at the node person so for the jr:table your query is /person/companies/company
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/companies/company")]]></dataSourceExpression>
</datasetRun>
For subDataset and field definition see the full example, it's more straight forward, since you are creating the datasource (subDatasource) the XPath query is actually not need for the subDataset (it's only needed on main query), you only need to have correct field declaration with same names as xml tags.
Full 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="report1_subreport1" pageWidth="756" pageHeight="140" whenNoDataType="BlankPage" columnWidth="756" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error" isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">
<field name="dateOfBirth" class="java.lang.String">
<fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>
</field>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">
<field name="nameOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[nameOfCompany]]></fieldDescription>
</field>
<field name="addressOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[addressOfCompany]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/report/subreport]]>
</queryString>
<field name="nameOfState" class="java.lang.String">
<property name="net.sf.jasperreports.xpath.field.expression" value="nameOfState"/>
<fieldDescription><![CDATA[nameOfState]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="140" splitType="Stretch">
<componentElement>
<reportElement x="0" y="36" width="753" height="104" uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="104" width="753">
<staticText>
<reportElement mode="Opaque" x="11" y="11" width="100" height="13" backcolor="#C0C0C0" uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Full name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="24" width="100" height="13" backcolor="#C0C0C0" uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address:]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="37" width="100" height="13" backcolor="#C0C0C0" uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Date of birth:]]></text>
</staticText>
<textField>
<reportElement x="112" y="11" width="239" height="13" uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="24" width="239" height="13" uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="37" width="239" height="13" uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement key="NajdenaOsobaTable1" style="table 3" stretchType="RelativeToBandHeight" mode="Transparent" x="96" y="66" width="645" height="25" isPrintWhenDetailOverflows="true" uuid="99480409-009b-4f75-b435-ad99403ddb56"/>
<jr:table whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/companies/company")]]></dataSourceExpression>
</datasetRun>
<jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="125" height="17" backcolor="#C0C0C0" uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Name of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="125" height="16" isPrintWhenDetailOverflows="true" uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="17" backcolor="#C0C0C0" uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="160" height="16" isPrintWhenDetailOverflows="true" uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{addressOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
<textField>
<reportElement x="12" y="10" width="100" height="20" uuid="a8753122-9817-4500-81f2-99d703df00b8"/>
<textFieldExpression><![CDATA[$F{nameOfState}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Result

Related

How to combine repited values in one border in Jasper Report?

I created Jasper report which doesn't print repited values in the first column "Route" (field name groupDescription)
It works ok, but the problem is - it doesn't combine borders of those repited values.
I tried add first column to separate group and change the borders, but it didn't help.
How can I combine borders as well, so in result report can look like this?
Here is my jrxml file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.19.1.final using JasperReports Library version 6.19.1-867c00bf88cd4d784d404379d6c05e1b419e8a4c -->
<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="gpsmisseddataonroute" pageWidth="705" pageHeight="842" columnWidth="685" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" isFloatColumnFooter="true" isIgnorePagination="true" uuid="3ebc481d-07fa-407e-8647-51d27f87c7f2">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.csv.field.delimiter" value=";"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Default" isDefault="true" pdfFontName="/fonts/ARIALN.TTF" pdfEncoding="Identity-H"/>
<parameter name="carrier" class="java.lang.String"/>
<parameter name="date" class="java.lang.String"/>
<parameter name="time" class="java.lang.String"/>
<parameter name="header" class="java.lang.String"/>
<parameter name="groupDescription" class="java.lang.String"/>
<parameter name="ordinal" class="java.lang.String"/>
<parameter name="licensePlate" class="java.lang.String"/>
<parameter name="lastEventTime" class="java.lang.String"/>
<parameter name="notes" class="java.lang.String"/>
<field name="groupDescription" class="java.lang.String"/>
<field name="ordinal" class="java.lang.String"/>
<field name="licensePlate" class="java.lang.String"/>
<field name="lastEventTime" class="java.lang.String"/>
<field name="notes" class="java.lang.String"/>
<title>
<band height="90">
<textField>
<reportElement x="65" y="20" width="284" height="20" uuid="1587c4cd-9174-4d1f-aa3e-665507834e77"/>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{carrier}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="65" y="40" width="284" height="20" uuid="1bb50a29-26f6-4389-b448-de69a4167c80"/>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="65" y="60" width="284" height="20" uuid="94b925f3-e71a-4094-a5f3-ac8d61fa2a62"/>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{time}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="685" height="20" uuid="49caef1a-d5a7-4174-a84f-1fb62d89d4c1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{header}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="40" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="245" y="0" width="29" height="35" backcolor="#999999" uuid="3ee4cb1f-ec9b-448f-b734-2427fd2764f8"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[#]]></text>
</staticText>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="274" y="0" width="46" height="35" backcolor="#999999" uuid="b7816a55-171c-40ea-bbea-fa6685309ba8"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{ordinal}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="320" y="0" width="130" height="35" backcolor="#999999" uuid="a6a976e9-6466-45b0-8f35-b32545efd711"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{licensePlate}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="450" y="0" width="112" height="35" backcolor="#999999" uuid="2190c925-a2e1-48f3-983b-9a4f7911de64"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{lastEventTime}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="562" y="0" width="123" height="35" backcolor="#999999" uuid="b4b3fe7d-8b2a-4d41-9544-d8f0beb5ae63"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{notes}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="0" width="245" height="35" backcolor="#999999" uuid="ada908a0-7ade-40e6-8c70-3d842fb45e05"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{groupDescription}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="29" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="245" y="0" width="29" height="24" uuid="a14ad59f-e9d5-4a26-8dae-efcb9e95484d"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" pdfEncoding="Identity-H"/>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="274" y="0" width="46" height="24" uuid="ca3caa3a-ef01-4ecd-8582-f499261ec6e0"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
<paragraph rightIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{ordinal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="320" y="0" width="130" height="24" uuid="6c0e24a2-f97c-43d0-a055-2f4d19e34225"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
<paragraph rightIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{licensePlate}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="450" y="0" width="112" height="24" uuid="1e0d4140-5702-4deb-bfe0-ef2bf50d9d92"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="2.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{lastEventTime}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="562" y="0" width="123" height="24" uuid="2953ab4e-507b-4f07-8ded-ff480873d557"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{notes}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="0" y="0" width="245" height="24" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="58eb7f6a-1f5c-47fb-b24a-275d92968a1d"/>
<box>
<pen lineWidth="1.0"/>
<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>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{groupDescription}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

In Jaspersoft studio 6, How to calculate total for a particular row in crosstab

I am using in Jaspersoft studio 6 and currently working with crosstab. I am a newbie in crosstab and have just started using it. I have created a jrxml file with crosstab(with lots of trial and error, I might add) as follows
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2022-06-29T20:43:31 -->
<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="MAH_Attendance_subjasper" pageWidth="1500" pageHeight="650" orientation="Landscape" columnWidth="1460" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0e151e12-e64e-4195-aba5-d1747d8a798d">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="MAH HR DB"/>
<style name="Crosstab_CH" mode="Opaque"/>
<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>
<style name="CS_Sunday" backcolor="#FFFFFF">
<conditionalStyle>
<conditionExpression><![CDATA[$V{DayOfWeeek}=="SUN"]]></conditionExpression>
<style forecolor="#058FFF" backcolor="#737373"/>
</conditionalStyle>
</style>
<queryString language="SQL">
<![CDATA[SELECT
emp.emp_number AS empNumber,
CONCAT_WS(" ",emp.first_name,emp.middle_name,emp.last_name)AS emp_name,
att.punch_in_time AS PunchInTime,
att.punch_out_time AS PunchOutTime,
TIME_FORMAT(TIMEDIFF(CONCAT(DATE(att.punch_out_date)," ",(att.punch_out_time)),CONCAT(DATE(att.punch_in_date)," ",(att.punch_in_time))),'%H:%i') AS Total,
att.shift_in_time AS Rosterin,
att.shift_out_time AS Rosterout,
TIME_FORMAT(TIMEDIFF(att.punch_out_time,att.shift_out_time),'%H:%i') AS Extra,
IFNULL(DATE(att.punch_in_date),'') AS punch_in_date,
DAYOFMONTH(att.punch_in_date) AS DayOfMonthh,
CASE
WHEN DAYOFWEEK(att.punch_in_date)=1 THEN 'SUN'
WHEN DAYOFWEEK(att.punch_in_date)=2 THEN 'MON'
WHEN DAYOFWEEK(att.punch_in_date)=3 THEN 'TUE'
WHEN DAYOFWEEK(att.punch_in_date)=4 THEN 'WED'
WHEN DAYOFWEEK(att.punch_in_date)=5 THEN 'THU'
WHEN DAYOFWEEK(att.punch_in_date)=6 THEN 'FRI'
WHEN DAYOFWEEK(att.punch_in_date)=7 THEN 'SAT'
END AS DayOfWeeek
FROM
hr_employees emp,
hr_pay_periods hpr,
hr_setup SETUP1,
hr_setup SETUP2,
hr_transfers tr,
hr_emp_attendance att
LEFT JOIN hr_leaves lv ON (att.employee_id=lv.employee_id AND att.punch_in_date BETWEEN lv.start_date AND lv.end_date)
LEFT JOIN hr_leave_types lt ON(lt.id = lv.leave_type_id AND lt.leave_division_code='LOP')
WHERE
emp.id =att.employee_id
AND emp.id =tr.employee_id
AND emp.emp_number=1
AND tr.active_yn='1'
AND DATE_FORMAT(tr.start_date,'%Y-%m-%d')<=DATE_FORMAT(hpr.end_date,'%Y-%m-%d')
AND (DATE_FORMAT(tr.end_date,'%Y-%m-%d')>=DATE_FORMAT(hpr.start_date,'%Y-%m-%d') OR tr.end_date IS NULL)
AND DATE_FORMAT(att.punch_in_date,'%Y-%m-%d') >=DATE_FORMAT(hpr.start_date,'%Y-%m-%d')
AND DATE_FORMAT(att.punch_in_date,'%Y-%m-%d') <=DATE_FORMAT(hpr.end_date,'%Y-%m-%d')
AND DATE_FORMAT(att.punch_in_date,'%Y-%m-%d') >=DATE_FORMAT(tr.start_date,'%Y-%m-%d')
AND (DATE_FORMAT(att.punch_in_date,'%Y-%m-%d')<=DATE_FORMAT(tr.end_date,'%Y-%m-%d') OR tr.end_date IS NULL)
AND SETUP1.setup_key="HR_EMPLOYEE_NUM_PREFIX"
AND SETUP2.setup_key="HR_EMPLOYEE_NUM_SUFFIX"
AND att.punch_in_date BETWEEN '2022-03-01' AND '2022-03-31'
ORDER BY emp.emp_number,punch_in_date]]>
</queryString>
<field name="empNumber" class="java.lang.String"/>
<field name="emp_name" class="java.lang.String"/>
<field name="PunchInTime" class="java.sql.Time"/>
<field name="PunchOutTime" class="java.sql.Time"/>
<field name="Total" class="java.sql.Time"/>
<field name="Rosterin" class="java.sql.Time"/>
<field name="Rosterout" class="java.sql.Time"/>
<field name="Extra" class="java.sql.Time"/>
<field name="punch_in_date" class="java.lang.Object"/>
<field name="DayOfMonthh" class="java.lang.Integer"/>
<field name="DayOfWeeek" class="java.lang.String"/>
<variable name="Variable_1" class="java.lang.String"/>
<variable name="Variable_2" class="java.lang.String"/>
<variable name="Variable_3" class="java.lang.String"/>
<variable name="Variable_4" class="java.lang.String"/>
<variable name="Variable_5" class="java.lang.String"/>
<variable name="Variable_6" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="161" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<crosstab ignoreWidth="false">
<reportElement x="0" y="0" width="1420" height="160" uuid="b9ff42cf-4d41-4581-93ba-9a6a0d737d58">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.crosstab.style.header" value="Crosstab_CH"/>
<property name="com.jaspersoft.studio.crosstab.style.group" value="Crosstab_CG"/>
<property name="com.jaspersoft.studio.crosstab.style.total" value="Crosstab_CT"/>
<property name="com.jaspersoft.studio.crosstab.style.detail" value="Crosstab_CD"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<crosstabHeaderCell>
<cellContents>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="0" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="5cb94b6f-b1c1-4751-8cc9-1023a08817ba"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Date"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" style="CS_Sunday" mode="Transparent" x="0" y="20" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="acfafcf8-f527-474d-8627-a7132a747c48"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Day"]]></textFieldExpression>
</textField>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="empNumber" width="60" mergeHeaderCells="false">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{empNumber}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="0" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="46855b10-d1a0-4975-b4a9-0c4e63fc8004"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["In"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="20" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="61085207-f106-4ae5-a7be-a40dd4f9e33b"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Out"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="40" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="577e468c-f2a4-4e42-99f1-287363338475"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Total"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="60" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="d89eaa0d-ddd9-4352-9fbb-46572e082ed5"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Roster In"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="80" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="1e60e74b-1df1-4a2b-8ba4-e639b7c95a47"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Roster Out"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="100" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="c9cb35b1-69d9-4075-8a74-2b6e3a5d4916">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Extra"]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents mode="Opaque" style="Crosstab_CT">
<staticText>
<reportElement x="0" y="0" width="0" height="0" forecolor="#FFFFFF" uuid="6b02ffab-4f0f-4c9b-ab2c-46ca85f651a3"/>
<text><![CDATA[Total empNumber]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="DayOfMonthh" height="20" totalPosition="End">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{DayOfMonthh}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement style="CS_Sunday" x="0" y="0" width="40" height="20" uuid="718bc55d-1ed4-460e-80dd-af8703ba0c90">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{DayOfMonthh}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CT">
<staticText>
<reportElement x="0" y="0" width="0" height="0" forecolor="#FFFFFF" uuid="07e7807e-6981-4dab-b854-c5c8bf274b97"/>
<text><![CDATA[Total DayOfMonthh]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="DayOfWeeek" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{DayOfWeeek}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="CS_Sunday">
<textField isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="0" width="40" height="20" uuid="23a405f5-a6c2-4f4a-be59-d9d5a9e16f3f"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{DayOfWeeek}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CG">
<staticText>
<reportElement x="0" y="0" width="40" height="20" uuid="edcbd158-c0e7-4268-aff9-0e302e553b25"/>
<text><![CDATA[Total DayOfWeeek]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="PunchInTime_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{PunchInTime}]]></measureExpression>
</measure>
<measure name="PunchOutTime_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{PunchOutTime}]]></measureExpression>
</measure>
<measure name="Total_MEASURE" class="java.sql.Time">
<measureExpression><![CDATA[$F{Total}]]></measureExpression>
</measure>
<measure name="Rosterin_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{Rosterin}]]></measureExpression>
</measure>
<measure name="Rosterout_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{Rosterout}]]></measureExpression>
</measure>
<measure name="Extra_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{Extra}]]></measureExpression>
</measure>
<measure name="Measure1" class="java.sql.Time" calculation="Sum">
<measureExpression><![CDATA[$F{Extra}]]></measureExpression>
</measure>
<crosstabCell width="40" height="120">
<cellContents mode="Opaque" style="Crosstab_CD">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="0" width="40" height="20" uuid="4b55089e-2a5c-4ce4-beea-3bb57815c61b"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PunchInTime_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="20" width="40" height="20" uuid="bd55a1cc-0094-482b-b3ff-35197f893d52"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PunchOutTime_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="40" width="40" height="20" uuid="6a7f1df0-e5df-42f1-8ca7-df0d2baa4ee5"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Total_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="60" width="40" height="20" uuid="84b3700f-d3e9-4401-be4e-db1b6c6ea42e"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Rosterin_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="80" width="40" height="20" uuid="d118ce37-b5d5-4082-8244-31941463812b"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Rosterout_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="100" width="40" height="20" uuid="f79896f4-39d6-4de6-8c6f-1ec067bd503e"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Extra_MEASURE}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="120" columnTotalGroup="DayOfMonthh">
<cellContents>
<textField pattern="HH:mm">
<reportElement x="0" y="0" width="40" height="120" uuid="3b6da2ce-2fe5-40b4-bbfb-2fed9b9d3217"/>
<textFieldExpression><![CDATA[$V{Measure1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="empNumber" columnTotalGroup="DayOfMonthh">
<cellContents/>
</crosstabCell>
<crosstabCell height="120" columnTotalGroup="DayOfWeeek">
<cellContents/>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="empNumber" columnTotalGroup="DayOfWeeek">
<cellContents/>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
Following is the output
https://ibb.co/x75CB7Y
I have 2 requirements:
I would like to show the sum for two rows - Total and Extra.
For the Sunday columns cells, I would like to have gray color as the background.
For the second item, I know that we can use conditional style. I have tried using it but I could not get it to work. I would appriciate any help.
Edit:
I have managed to add a new measure for the sum. But as the field is of the type java.sql.Time, I am unable to get the sum of all rows. It just gives the last value of the row in the sum measure field. I have updated the jrxml file and the output above. Is there any workaround for getting the sum of time values?

Sum columns based on custom group (Jasper Reports) [duplicate]

First of all, the records are shown in the table by table component but not in the report one.
The results looks like this:
YEARS MONTHS SUMMONTH SUMQUARTER
----- ------ -------- ----------
2009 Jan 130984 432041
Feb 146503
Mar 154554
Apr 147917 435150
May 131822
Jun 155411
Jul 144000 424806
Aug 130369
Sep 150437
Oct 112137 400114
Nov 152057
Dec 135920
=====================================
Jan-Dec 1692111
=====================================
2010 Jan 139927 417564
Feb 154940
Mar 122697
Apr 163257 413305
May 124999
Jun 125049
Jul 145127 427612
Aug 138804
Sep 143681
Oct 143398 406381
Nov 125351
Dec 137632
=====================================
Jan-Dec 1664862
=====================================
The sumquarter column shows the sum of each quarter in year.
They are not printed when it repeated the value of the field.
The question is how to group the column of sumquarter, so that the first printed repeated value in each row to join the next repeated value to become a single cell until it meets the non-repeated value?
You can simply see it in an image.
Below is the image that the table shows and the solution that I preferred is to group those 3 months of sum into a single cell.
Here is the image:
You can use this sample:
<?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="year_sum_quarter" language="groovy" 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"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="year" class="java.lang.Integer"/>
<field name="month" class="java.lang.String"/>
<field name="sum" class="java.lang.Integer"/>
<field name="q" class="java.lang.Integer"/>
<variable name="yearSum" class="java.lang.Integer" resetType="Group" resetGroup="yearGroup" calculation="Sum">
<variableExpression><![CDATA[$F{sum}]]></variableExpression>
</variable>
<variable name="qSum" class="java.lang.Integer" resetType="Group" resetGroup="quaterGroup" calculation="Sum">
<variableExpression><![CDATA[$F{sum}]]></variableExpression>
</variable>
<group name="yearGroup">
<groupExpression><![CDATA[$F{year}]]></groupExpression>
<groupFooter>
<band height="20">
<textField>
<reportElement x="100" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA["Jan-Dec, " + $F{year}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="200" y="0" width="100" height="20"/>
<box leftPadding="0">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$V{yearSum}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="0" width="100" height="20"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[]]></text>
</staticText>
<staticText>
<reportElement x="300" y="0" width="100" height="20"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[]]></text>
</staticText>
</band>
</groupFooter>
</group>
<group name="quaterGroup">
<groupExpression><![CDATA[$F{year} + $F{q}]]></groupExpression>
</group>
<columnHeader>
<band height="50">
<staticText>
<reportElement x="100" y="30" width="100" height="20"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Month]]></text>
</staticText>
<staticText>
<reportElement x="0" y="30" width="100" height="20"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Year]]></text>
</staticText>
<staticText>
<reportElement x="200" y="30" width="100" height="20"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Month Sum]]></text>
</staticText>
<staticText>
<reportElement x="300" y="30" width="100" height="20"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Quarter Sum]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="300" y="0" width="100" height="20"/>
<box>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[]]></text>
</staticText>
<staticText>
<reportElement x="0" y="0" width="100" height="20"/>
<box>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[]]></text>
</staticText>
<textField>
<reportElement x="0" y="0" width="100" height="20">
<printWhenExpression><![CDATA[$V{yearGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<box leftPadding="10">
<topPen lineWidth="0.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{year}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="200" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{sum}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="100" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{month}]]></textFieldExpression>
</textField>
<textField evaluationTime="Group" evaluationGroup="quaterGroup" isBlankWhenNull="false">
<reportElement stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="300" y="0" width="100" height="20" printWhenGroupChanges="quaterGroup">
<printWhenExpression><![CDATA[$V{quaterGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<box leftPadding="10">
<topPen lineWidth="0.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$V{qSum}]]></textFieldExpression>
</textField>
<line>
<reportElement x="300" y="0" width="100" height="1" printWhenGroupChanges="quaterGroup">
<printWhenExpression><![CDATA[$V{quaterGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
</line>
</band>
</detail>
</jasperReport>
The result will be (in pdf format):
In this sample I've used two elements in the Detail band for the Year column:
one textField with only vertical borders and with printWhenExpression: "$V{yearGroup_COUNT} == 1" property (I'm show it only once for the whole yearGroup) and one staticText without any text and with only vertical borders.
I've used three elements in the Detail band for the Quarter Sum column:
one textField with only vertical borders and with printWhenExpression: "$V{quaterGroup_COUNT} == 1" property (I'm show it only once for the whole quaterGroup), one staticText without any text and with only vertical borders and the line element for drawing horizontal border with printWhenExpression: "$V{quaterGroup_COUNT} == 1" property.

jaspersoft report bar graph

I have a query as below. I'd like to display number of requests for the 3 consecutive fiscal years (FY1, FY2, FY3). The bar graph only shows data for FY1. How do I display 3 bars within the graph?
select count(unique(p1.requestNumber)) as FY1, count(unique(p2.requestNumber)) as FY2, count(unique(p3.requestNumber)) as FY3
from fd.bankRequest P1, fd.bankRequest P2, fd.bankRequest P3
where
to_char(P1.requestDate, 'yyyymm') between (to_char(sysdate, 'yyyy')|| '10') and to_char(sysdate, 'yyyymm')
and
(to_char(P2.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -1) || '10') and (to_char(sysdate, 'yyyy') || '09'))
and
(to_char(P3.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -2) || '10') and (to_number(to_char(sysdate, 'yyyy') -1) || '09'))
and
to_number(to_char(sysdate, 'mm')) >= 10
The jrxml codes as below
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.1.final using JasperReports Library version 6.2.1 -->
<!-- 2016-11-23T12:32:37 -->
<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="FYRpt" language="groovy" pageWidth="612" pageHeight="792" whenNoDataType="AllSectionsNoDetail" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" isIgnorePagination="true" uuid="8a465670-cc4a-4270-965f-8efb86e33b71">
<property name="template.engine" value="tabular_template"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ojdbc7"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<style name="Table">
<box>
<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>
</style>
<style name="Table_TH" 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>
<style name="Table 1_TH" 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="Table 2_TH" 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="Table 3_TH" 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="Table 3_CH" 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="Table 3_TD" 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>
<subDataset name="FiscalYear" uuid="653c97d8-f01f-433a-8f37-19831ca0c04e">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ojdbc7"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<queryString>
<![CDATA[select count(unique(p1.requestNumber)) as FY1, count(unique(p2.requestNumber)) as FY2, count(unique(p3.requestNumber)) as FY3
from fd.bankRequest P1, fd.bankRequest P2, fd.bankRequest P3
where
to_char(P1.requestDate, 'yyyymm') between (to_char(sysdate, 'yyyy')|| '10') and to_char(sysdate, 'yyyymm')
and
(to_char(P2.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -1) || '10') and (to_char(sysdate, 'yyyy') || '09'))
and
(to_char(P3.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -2) || '10') and (to_number(to_char(sysdate, 'yyyy') -1) || '09'))
and
to_number(to_char(sysdate, 'mm')) >= 10]]>
</queryString>
<field name="FY1" class="java.math.BigDecimal"/>
<field name="FY2" class="java.math.BigDecimal"/>
<field name="FY3" class="java.math.BigDecimal"/>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="60" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<image>
<reportElement x="0" y="0" width="222" height="36" uuid="a9fbad6a-651d-43cd-bfb6-2cf334d623ed"/>
<imageExpression><![CDATA["C:/jboss-eap-6.4/NX-runtime/reports/Images/Logo.png"]]></imageExpression>
</image>
<staticText>
<reportElement x="280" y="0" width="209" height="30" uuid="4d5423b2-708b-4afa-9ffd-f7ce5b8135f6"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Executive Summary]]></text>
</staticText>
<textField isStretchWithOverflow="true" pattern="">
<reportElement x="380" y="30" width="191" height="20" forecolor="#000000" uuid="d770f29c-b0d4-4161-87d6-db5a2c36754e">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="11"/>
</textElement>
<textFieldExpression><![CDATA["Report created on " + new SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date())]]></textFieldExpression>
</textField>
</band>
</title>
<pageFooter>
<band height="65">
<textField>
<reportElement positionType="Float" x="210" y="40" width="361" height="20" uuid="6ca8797f-653d-46a0-a24f-d286078dccc8"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="11"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER} + " of " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="581" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<textField>
<reportElement x="10" y="0" width="570" height="20" uuid="8956e672-accf-461b-b2b1-e81f70e8e87e">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Fiscal Year Report"]]></textFieldExpression>
</textField>
<componentElement>
<reportElement x="10" y="50" width="200" height="120" uuid="eba4eb25-553f-424c-aba2-c124b35957cb">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 3_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 3_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table 3_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="FiscalYear" uuid="e5979756-be6d-498c-8502-b9217b605591">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="110" uuid="b11b4e94-29e6-497e-8534-55832acd42d9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableFooter style="Table 3_TH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="110" height="30" uuid="e1165115-bb42-4a58-bb64-96782790ae11"/>
<box leftPadding="6"/>
<textElement verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),1))]]></textFieldExpression>
</textField>
</jr:tableFooter>
<jr:columnHeader style="Table 3_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="110" height="30" uuid="a5e2a06a-8ab3-471b-82a1-dd9288957ede"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Fiscal Year (FY)]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="Table 3_CH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="110" height="30" uuid="61a4651f-cb1d-416f-a32e-68beb2d1c219"/>
<box leftPadding="6"/>
<textElement verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA["FY " + YEAR(TODAY())]]></textFieldExpression>
</textField>
</jr:columnFooter>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="110" height="30" uuid="6eb9c024-cc8f-4810-bf96-22de20b8eca7"/>
<box leftPadding="6"/>
<textElement verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),-1))]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="a0501979-12d2-43ab-9f50-c3a0814888c4">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableFooter style="Table 3_TH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" forecolor="#000000" uuid="d1c24563-2f4c-4948-92a5-507a91344541"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{FY3}]]></textFieldExpression>
</textField>
</jr:tableFooter>
<jr:columnHeader style="Table 3_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="64033655-a2a1-4260-84bb-940d2e71fcc1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Total Requests]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="Table 3_CH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" uuid="43b0b490-b093-482f-a6b5-6473ffa4ba6d"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{FY2}]]></textFieldExpression>
</textField>
</jr:columnFooter>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" uuid="00bdeea7-5bea-4d71-8ef7-29cf59c25df6"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{FY1}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
<barChart>
<chart evaluationTime="Report" theme="eye.candy.sixties">
<reportElement x="240" y="50" width="322" height="190" uuid="91806aa7-467e-4cf4-a723-e6de7db10c18"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="FiscalYear" uuid="f3908198-41a0-41b6-99d5-0af1af893936">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),-1))]]></seriesExpression>
<categoryExpression><![CDATA[($F{FY1} ? "FY" + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),-1))
: $F{FY2} ? "FY " + YEAR(TODAY())
: "FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),1)))]]></categoryExpression>
<valueExpression><![CDATA[$F{FY1}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["FY " + YEAR(TODAY())]]></seriesExpression>
<categoryExpression><![CDATA[0]]></categoryExpression>
<valueExpression><![CDATA[0]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),1))]]></seriesExpression>
<categoryExpression><![CDATA[0]]></categoryExpression>
<valueExpression><![CDATA[0]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot isShowLabels="true">
<plot/>
<itemLabel/>
<categoryAxisFormat>
<axisFormat/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</summary>
</jasperReport>

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.