When i'm trying to preview the data in IReports by clicking the preview tab, it is just flashing and going back, but i'm unable to see the data.
Below is my XML.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report5" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b8a981bc-ae9b-4fcf-8400-f9ecea0567f2">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Crosstab Data Text" hAlign="Center"/>
<queryString>
<![CDATA[SELECT
`Date assigned` AS Date_assigned,
Units,
`Assigned to PS` AS Assigned_to_PS
FROM
[Sheet1$]
]]>
</queryString>
<field name="Date_assigned" class="java.sql.Timestamp"/>
<field name="Units" class="java.lang.Double"/>
<field name="Assigned_to_PS" class="java.lang.String"/>
<group name="Date_assigned">
<groupExpression><![CDATA[$F{Date_assigned}]]></groupExpression>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<crosstab>
<reportElement uuid="db476b5b-d93f-4819-a8f6-174bfc88c9b7" x="0" y="0" width="802" height="125"/>
<rowGroup name="Date_assigned" width="70" totalPosition="End">
<bucket class="java.util.Date">
<bucketExpression><![CDATA[$F{Date_assigned}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="cb26a0e2-7fa8-4124-be7f-f91e491801f7" style="Crosstab Data Text" x="0" y="0" width="70" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{Date_assigned}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement uuid="c97deff9-a499-4330-aa84-baf20315a1de" x="0" y="0" width="70" height="25"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total Date_assigned]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="Assigned_to_PS" height="30" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{Assigned_to_PS}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="7e26e7de-b54f-4490-9ea1-b087247e9c06" style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$V{Assigned_to_PS}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement uuid="86c2ceb5-b2d2-4cc7-953e-0c039e807ec1" x="86" y="0" width="50" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total Assigned_to_PS]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="UnitssMeasure" class="java.lang.Double" calculation="Sum">
<measureExpression><![CDATA[$F{Unitss}]]></measureExpression>
</measure>
<crosstabCell width="120" height="38">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="7729498a-0309-4052-a002-e58592da972b" style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{UnitssMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="120" height="61" rowTotalGroup="Date_assigned">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="35ba6c60-5505-4eba-be7b-8627a9516c7d" style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{UnitssMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="136" height="38" columnTotalGroup="Assigned_to_PS">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="c260e58c-5377-4582-bdfe-59a3f337feee" style="Crosstab Data Text" x="86" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{UnitssMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="136" height="61" rowTotalGroup="Date_assigned" columnTotalGroup="Assigned_to_PS">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="468233cd-75a6-4278-ba3f-de35032a5459" style="Crosstab Data Text" x="86" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{UnitssMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
This is actually a pivot table from excel data source, please let me know how do i preview it. And also i'm not getting any errors.
expected output is
Amreen Anirudh Anand Total
7/1/2013 158 158
7/2/2013 23 23
7/3/2013 152 748 900
7/4/2013
7/5/2013
7/6/2013 435 435
7/7/2013 170 170
7/8/2013 66 66
7/9/2013 33 33 66
Total 1037 748 33 1818
Thanks
Related
I try to give Persian text and numbers in xlsx. I want the numbers to be displayed in Arabic and Persian
As you can see, Persian font is applied and the numbers are in Persian but not so in xlsx
As you see font set but not applied On the other hand, the "B Farnaz" font is installed in the Windows operating system
<?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="rptReport"
pageWidth="842"
pageHeight="595"
orientation="Landscape"
columnWidth="802"
leftMargin="20"
rightMargin="20"
topMargin="20"
bottomMargin="20"
whenNoDataType="AllSectionsNoDetail">
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.2" value="pageFooter"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.3" value="title"/>
<property name="net.sf.jasperreports.crosstab.ignore.width" value="true"/>
<style name="textStyle" hTextAlign="Center" vTextAlign="Middle" fontName="B Farnaz" fontSize="10" pdfFontName= "C:/fonts/nazanin.ttf" pdfEncoding="Identity-H"/>
<parameter name="reportName" class="java.lang.String"/>
<parameter name="currentDate" class="java.lang.String"/>
<parameter name="number" class="java.lang.String"/>
<parameter name="pageName" class="java.lang.String"/>
<parameter name="ofName" class="java.lang.String"/>
<parameter name="logo" class="java.io.InputStream"/>
<field name="count" class="java.lang.Integer"/>
<field name="organizationId" class="java.lang.String"/>
<field name="orgName" class="java.lang.String"/>
<field name="orgCode" class="java.lang.String"/>
<field name="orgTypeName" class="java.lang.String"/>
<field name="positionId" class="java.lang.String"/>
<field name="title" class="java.lang.String"/>
<field name="orgParentName" class="java.lang.String"/>
<title>
<band height="61">
<rectangle>
<reportElement x="0" y="0" width="802" height="60" uuid="e0e43037-9be9-410e-9e49-9f03a811629b"/>
<graphicElement>
<pen lineWidth="0.75"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="70" y="13" width="40" height="20" uuid="80c01bc2-7498-4a53-9183-9716832fa86e"/>
<textElement textAlignment="Left">
<font fontName="B Farnaz" size="14" pdfFontName= "C:/Users/m.shadkam/Desktop/PORTAL/portal-server/src/main/resources/report/fonts/nazanin.ttf" pdfEncoding="Identity-H"/>
</textElement>
<text><![CDATA[تاريخ :]]></text>
</staticText>
<staticText>
<reportElement x="70" y="35" width="40" height="20" uuid="df222e3e-0a63-4cff-8b4a-7b7d6cdad5b2"/>
<textElement textAlignment="Left">
<font fontName="B Farnaz" size="14" pdfFontName= "C:/Users/m.shadkam/Desktop/PORTAL/portal-server/src/main/resources/report/fonts/nazanin.ttf" pdfEncoding="Identity-H"/>
</textElement>
<text><![CDATA[شماره :]]></text>
</staticText>
<image hAlign="Right">
<reportElement x="690" y="13" width="110" height="44" uuid="6b166494-6df6-4472-8140-da4f93644616"/>
<imageExpression><![CDATA[$P{logo}]]></imageExpression>
</image>
<textField>
<reportElement x="3" y="35" width="65" height="20" uuid="52b5428c-f329-4d65-be61-51e529269ca7"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="B Farnaz" pdfFontName= "C:/fonts/BNAZANIN.TTF" pdfEncoding="Identity-H"/>
</textElement>
<textFieldExpression><![CDATA[$P{number}]]></textFieldExpression>
</textField>
<textField pattern="">
<reportElement x="0" y="1" width="802" height="35" uuid="c9904a66-50ba-4cee-9fa9-b6b29feec8b0"/>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="B Farnaz" size="14" pdfFontName= "C:/fonts/titr.ttf" pdfEncoding="Identity-H"/>
</textElement>
<textFieldExpression><![CDATA[$P{reportName}]]></textFieldExpression>
</textField>
<textField pattern="">
<reportElement x="3" y="13" width="65" height="20" uuid="fdc85694-ba29-4858-915e-23399415a806"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="B Farnaz" pdfFontName= "C:/fonts/BNAZANIN.TTF" pdfEncoding="Identity-H"/>
</textElement>
<textFieldExpression><![CDATA[$P{currentDate}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="20">
<textField>
<reportElement x="739" y="0" width="63" height="20" />
<textElement textAlignment="Right">
<font fontName="B Farnaz" pdfFontName="C:/fonts/BNAZANIN.TTF" pdfEncoding="Identity-H"/>
</textElement>
<textFieldExpression><![CDATA[$P{pageName} + " " + $V{PAGE_NUMBER} + " " + $P{ofName} +" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<pageFooter>
<band height="23" splitType="Stretch">
<textField>
<reportElement x="0" y="2" width="802" height="20" uuid="b8f61bae-86d8-4a73-8c23-3484b431a65e"/>
<textElement textAlignment="Center">
<font fontName="B Farnaz" pdfFontName= "C:/fonts/BNAZANIN.TTF" pdfEncoding="Identity-H"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height = "79">
<crosstab ignoreWidth="true">
<reportElement x="0" y="0" height="79" width="500"/>
<crosstabHeaderCell>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="100" y="0" width="100" height="100" />
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textFieldExpression><![CDATA["اداره امور"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="textStyle" x="0" y="0" width="100" height="100" />
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textFieldExpression><![CDATA["واحد/کادر"]]></textFieldExpression>
</textField>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="orgName" width="100" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{orgName}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="100" height="25" uuid="722e2c03-df3c-4012-aecf-91b7a8bad18d"/>
<textFieldExpression><![CDATA[$V{orgName}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement style="textStyle" x="0" y="0" width="200" height="25" uuid="4e9afca3-c0a3-4182-b3ce-9afb39fd3468"/>
<text><![CDATA[کل]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<rowGroup name="orgParentName" width="100" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{orgParentName}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="100" height="25" uuid="63804c09-f3f6-401f-8598-fa2e35860a8f"/>
<textFieldExpression><![CDATA[$V{orgParentName}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="title" height="100" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{title}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="25" height="100" uuid="7edd05fd-4252-404d-bb82-54a705040663"/>
<textElement rotation="Left"/>
<textFieldExpression><![CDATA[$V{title}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement style="textStyle" x="0" y="0" width="25" height="100" uuid="de037370-9595-4ab0-8d55-ec94159f9ca0"/>
<textElement rotation="Left"/>
<text><![CDATA[کل]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="countMeasure" class="java.lang.Integer" calculation="Sum">
<measureExpression><![CDATA[$F{count}]]></measureExpression>
</measure>
<crosstabCell width="25" height="25">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="25" height="25" uuid="2de587ed-74f0-46c2-8425-5a4e9bd120e6"/>
<textFieldExpression><![CDATA[$V{countMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="orgName">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="25" height="25" uuid="e7dd4c40-847f-4df0-b910-f99566746ecb"/>
<textFieldExpression><![CDATA[$V{countMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="25" columnTotalGroup="title">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="25" height="25" uuid="2ed6a617-5440-4bee-931e-dc4e16f0539d"/>
<textFieldExpression><![CDATA[$V{countMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="orgName" columnTotalGroup="title">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="textStyle" x="0" y="0" width="25" height="25"/>
<textFieldExpression><![CDATA[$V{countMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="0" rowTotalGroup="orgParentName">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
</cellContents>
</crosstabCell>
<crosstabCell height="0" rowTotalGroup="orgParentName" columnTotalGroup="title">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
I used Persian font in the report, but this Persian font is not applied in the xlsx version of the report, but is applied correctly in the pdf version.
I also used the font exception to solve this problem but it did not work for the excel version.
Please help me to display the text and numbers in xlsx like pdf correctly
How to obtain this situation (move the last column as new dynamic row) in jasper?
Jrxml code: https://pastebin.com/sMa1Cct2
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final utlizzo versione della libreria JasperReports6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<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="template_Table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1a0aa80b-dc07-4dca-bdbc-aa78eeb0d12b">
<style name="Table_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_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_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="ItemDataset" uuid="2914f7c6-c2d7-448b-b0c1-090970e18ed6">
<queryString>
<![CDATA[]]>
</queryString>
<field name="descrizione" class="java.lang.String"/>
<field name="numero_depositanti" class="java.lang.String"/>
<field name="quantita" class="java.lang.String"/>
<field name="percentuale" class="java.lang.String"/>
<field name="conti" class="java.util.List"/>
<group name="Group1"/>
</subDataset>
<parameter name="ItemDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="256" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="555" height="200" uuid="7786bb05-503a-4b6a-991a-a7bcf3abad07">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</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="ItemDataset" uuid="d3e1e03a-2c83-4436-9e50-79518bc3d337">
<dataSourceExpression><![CDATA[$P{ItemDataSource}]]></dataSourceExpression>
</datasetRun>
<jr:column width="75" uuid="dca8961f-ce2d-47ac-879c-b15847d170a9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna1"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="75" height="30" uuid="f60d1675-6fb6-4569-93ca-de32b3a8e861"/>
<text><![CDATA[Descrizione]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="75" height="30" uuid="f1de366a-b36f-4200-9b1e-7a0009be5373"/>
<textFieldExpression><![CDATA[$F{descrizione}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="140" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna2"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="140" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Numero depositanti]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="140" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{numero_depositanti}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna3"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Quantita]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{quantita}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna4"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Percentuale]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{percentuale}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="140" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna5"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="140" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Percentuale]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="140" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{conti}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="75" height="20" backcolor="#151515" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb6b"/>
<text><![CDATA[descrizione]]></text>
</staticText>
<staticText>
<reportElement x="151" y="0" width="100" height="20" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb68"/>
<text><![CDATA[quantita]]></text>
</staticText>
<staticText>
<reportElement x="226" y="0" width="75" height="20" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb69"/>
<text><![CDATA[percentuale]]></text>
</staticText>
</band>
</detail>
</jasperReport>
Playing around I found another possible way (without the data I can't confirm it working). :
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1 -->
<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="template_Table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1a0aa80b-dc07-4dca-bdbc-aa78eeb0d12b">
<style name="Table_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_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_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="ItemDataset" uuid="2914f7c6-c2d7-448b-b0c1-090970e18ed6">
<queryString>
<![CDATA[]]>
</queryString>
<field name="descrizione" class="java.lang.String"/>
<field name="numero_depositanti" class="java.lang.String"/>
<field name="quantita" class="java.lang.String"/>
<field name="percentuale" class="java.lang.String"/>
<field name="conti" class="java.util.List"/>
<group name="Group1"/>
</subDataset>
<parameter name="ItemDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="256" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="555" height="200" uuid="7786bb05-503a-4b6a-991a-a7bcf3abad07">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</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="ItemDataset" uuid="d3e1e03a-2c83-4436-9e50-79518bc3d337">
<dataSourceExpression><![CDATA[$P{ItemDataSource}]]></dataSourceExpression>
</datasetRun>
<jr:column width="75" uuid="dca8961f-ce2d-47ac-879c-b15847d170a9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna1"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="75" height="30" uuid="f60d1675-6fb6-4569-93ca-de32b3a8e861"/>
<text><![CDATA[Descrizione]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="60">
<textField>
<reportElement x="0" y="0" width="75" height="60" uuid="f1de366a-b36f-4200-9b1e-7a0009be5373"/>
<textFieldExpression><![CDATA[$F{descrizione}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="225" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna2"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="225" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Numero depositanti]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="60">
<textField>
<reportElement x="0" y="0" width="225" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{numero_depositanti}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="30" width="225" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{conti}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="101" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna3"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="101" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Quantita]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="60">
<textField>
<reportElement x="0" y="0" width="101" height="60" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{quantita}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="99" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna4"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="99" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Percentuale]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="60">
<textField>
<reportElement x="0" y="0" width="99" height="60" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{percentuale}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="55" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonna5"/>
<jr:tableHeader height="30" rowSpan="1"/>
<jr:detailCell height="60">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="75" height="20" backcolor="#151515" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb6b"/>
<text><![CDATA[descrizione]]></text>
</staticText>
<staticText>
<reportElement x="151" y="0" width="100" height="20" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb68"/>
<text><![CDATA[quantita]]></text>
</staticText>
<staticText>
<reportElement x="226" y="0" width="75" height="20" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb69"/>
<text><![CDATA[percentuale]]></text>
</staticText>
</band>
</detail>
</jasperReport>
The only option I see is, that you have to create a new table with only this one property.
Then you can layout it that it looks like one table:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1 -->
<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="template_Table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1a0aa80b-dc07-4dca-bdbc-aa78eeb0d12b">
<style name="Table_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_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_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="ItemDataset" uuid="2914f7c6-c2d7-448b-b0c1-090970e18ed6">
<queryString>
<![CDATA[]]>
</queryString>
<field name="descrizione" class="java.lang.String"/>
<field name="numero_depositanti" class="java.lang.String"/>
<field name="quantita" class="java.lang.String"/>
<field name="percentuale" class="java.lang.String"/>
<field name="conti" class="java.util.List"/>
<group name="Group1"/>
</subDataset>
<parameter name="ItemDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="256" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="555" height="60" uuid="7786bb05-503a-4b6a-991a-a7bcf3abad07">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</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="ItemDataset" uuid="d3e1e03a-2c83-4436-9e50-79518bc3d337">
<dataSourceExpression><![CDATA[$P{ItemDataSource}]]></dataSourceExpression>
</datasetRun>
<jr:column width="75" uuid="dca8961f-ce2d-47ac-879c-b15847d170a9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="75" height="30" uuid="f60d1675-6fb6-4569-93ca-de32b3a8e861"/>
<text><![CDATA[Descrizione]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="75" height="30" uuid="f1de366a-b36f-4200-9b1e-7a0009be5373"/>
<textFieldExpression><![CDATA[$F{descrizione}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="140" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="140" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Numero depositanti]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="140" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{numero_depositanti}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Quantita]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{quantita}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="105" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
<jr:tableHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="105" height="30" uuid="16679b95-2e6e-4ca1-b8b6-dd7b74267c56"/>
<text><![CDATA[Percentuale]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="105" height="30" uuid="341e7faf-9680-4941-a9a4-ac78b8f4aae0"/>
<textFieldExpression><![CDATA[$F{percentuale}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="140" uuid="980fffb5-1088-47a6-b00f-b5d08b7093c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableHeader height="30" rowSpan="1"/>
<jr:detailCell height="30"/>
</jr:column>
</jr:table>
</componentElement>
<componentElement>
<reportElement x="0" y="60" width="555" height="30" uuid="05eb78da-89c1-4af6-bdad-79a3b8ca819d">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</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="ItemDataset" uuid="c27bd785-53a9-4bcc-a1cc-3950f707d796">
<dataSourceExpression><![CDATA[$P{ItemDataSource}]]></dataSourceExpression>
</datasetRun>
<jr:column width="75" uuid="7b446ae4-9502-48e3-afd5-6957e705f284">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:detailCell height="30"/>
</jr:column>
<jr:column width="345" uuid="06c2486d-3e7c-4b64-9282-e1c58541e69c">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:detailCell height="30">
<textField>
<reportElement x="0" y="0" width="345" height="30" uuid="8a99019f-ad26-4182-ad81-e61b356dcefe"/>
<textFieldExpression><![CDATA[$F{conti}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="75" height="20" backcolor="#151515" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb6b"/>
<text><![CDATA[descrizione]]></text>
</staticText>
<staticText>
<reportElement x="151" y="0" width="100" height="20" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb68"/>
<text><![CDATA[quantita]]></text>
</staticText>
<staticText>
<reportElement x="226" y="0" width="75" height="20" uuid="3316e9fe-e7e7-4020-84d6-a8f16cd8eb69"/>
<text><![CDATA[percentuale]]></text>
</staticText>
</band>
</detail>
</jasperReport>
I am using jasper report version 6.1 and wanted page break after pre-defined number of rows in the jr:table component. I have also tried doing the same in version 5 and it works fine but in version 6+ I am not able to do it.
Sharing the links which I followed if any one have other solution please let me know.
http://community.jaspersoft.com/wiki/ireport-how-introduce-page-break-after-pre-defined-number-rows-table-component
http://community.jaspersoft.com/questions/845487/inserting-break-table-print-only-10-rows-page-jasper-reports-372
This is what I have tried:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.0.final using JasperReports Library version 6.1.0 -->
<!-- 2017-05-29T15:29:33 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="957c1fea-8994-4195-9d7a-2bbf0baf7180">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Max apex"/>
<style name="Table_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_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_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="Dataset1" uuid="435d51b0-6d3e-442e-9a96-ae7412b12278">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Max apex"/>
<queryString>
<![CDATA[select * from dept]]>
</queryString>
<field name="DEPTNO" class="java.math.BigDecimal"/>
<field name="DNAME" class="java.lang.String"/>
<field name="LOC" class="java.lang.String"/>
<group name="DEPTNO">
<groupExpression><![CDATA[$F{DEPTNO}]]></groupExpression>
</group>
<group name="DNAME">
<groupExpression><![CDATA[$F{DNAME}]]></groupExpression>
</group>
<group name="LOC">
<groupExpression><![CDATA[$F{LOC}]]></groupExpression>
</group>
</subDataset>
<queryString>
<![CDATA[select * from dept]]>
</queryString>
<field name="DEPTNO" class="java.math.BigDecimal"/>
<field name="DNAME" class="java.lang.String"/>
<field name="LOC" class="java.lang.String"/>
<group name="DEPTNO">
<groupExpression><![CDATA[$F{DEPTNO}]]></groupExpression>
</group>
<group name="DNAME">
<groupExpression><![CDATA[$F{DNAME}]]></groupExpression>
</group>
<group name="LOC">
<groupExpression><![CDATA[$F{LOC}]]></groupExpression>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="145" splitType="Stretch">
<componentElement>
<reportElement positionType="FixRelativeToBottom" x="10" y="0" width="500" height="110" uuid="b37c89ae-600a-4fb8-ac64-e142bfe22e13"/>
<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="Dataset1" uuid="8f84378b-9508-4763-8265-69e68c41febe">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="100" uuid="00a00921-f5fa-4352-924c-f0531c919f71">
<jr:columnHeader style="Table_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="d88580f8-05d2-4eb0-a098-00e877c58c39"/>
<text><![CDATA[DEPTNO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="90" height="30" uuid="15fda94a-b686-4808-b55c-3e08a8e86187"/>
<textFieldExpression><![CDATA[$F{DEPTNO}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="140" uuid="72e58aec-00f1-4937-8600-b32a6010d4d6">
<jr:columnHeader style="Table_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="130" height="30" uuid="942c89ca-e914-4809-bb18-3b7065b413f7"/>
<text><![CDATA[DNAME]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="130" height="30" uuid="8b936e63-5f84-4fd7-b21c-8c08fb9550a5"/>
<textFieldExpression><![CDATA[$F{DNAME}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="140" uuid="f312cbac-4554-492c-928f-dd84b5a55d42">
<jr:columnHeader style="Table_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="120" height="30" uuid="ce385917-88aa-4e51-9cae-a7a142f78323"/>
<text><![CDATA[LOC]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="120" height="30" uuid="0e43f425-558c-4001-9c44-ca14798bcb75"/>
<textFieldExpression><![CDATA[$F{LOC}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
The solution to use a a group expression inside the subdatset works perfectly fine also in jasper reports v6+.
Example (built from code and data from this answer)
Adding groupExpression to the subDataset to break to new page every 2 records ($V{REPORT_COUNT}-1)/2)
<subDataset name="tableDataset" uuid="7a53770f-0350-4a73-bfc1-48a5f6386594">
<field name="User" class="java.lang.String"/>
<field name="Rep" class="java.math.BigDecimal"/>
<group name="pageBreakGroup" isStartNewPage="true">
<groupExpression><![CDATA[(int)(($V{REPORT_COUNT}-1)/2)]]></groupExpression>
</group>
</subDataset>
Expand code snippet for full code.
<?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="reputation" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a88bd694-4f90-41fc-84d0-002b90b2d73e">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="CVS"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="tableDataset" uuid="7a53770f-0350-4a73-bfc1-48a5f6386594">
<field name="User" class="java.lang.String"/>
<field name="Rep" class="java.math.BigDecimal"/>
<group name="pageBreakGroup" isStartNewPage="true">
<groupExpression><![CDATA[(int)(($V{REPORT_COUNT}-1)/2d)]]></groupExpression>
</group>
</subDataset>
<parameter name="displayRecordNumber" class="java.lang.Boolean">
<defaultValueExpression><![CDATA[true]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="50">
<componentElement>
<reportElement key="table" style="table" x="0" y="0" width="555" height="47" uuid="76ab08c6-e757-4785-a43d-b65ad4ab1dd5"/>
<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="tableDataset" uuid="07e5f1c2-af7f-4373-b653-c127c47c9fa4">
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
</datasetRun>
<jr:column width="90" uuid="918270fe-25c8-4a9b-a872-91299cddbc31">
<printWhenExpression><![CDATA[$P{displayRecordNumber}]]></printWhenExpression>
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="5cd6da41-01d5-4f74-99c2-06784f891d1e"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Record number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="30" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="30" uuid="5fe48359-0e7e-44b2-93ac-f55404189832"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="7979d8a2-4e3c-42a7-9ff9-86f8e0b164bc">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="61d5f1b6-7677-4511-a10c-1fb8a56a4b2a"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Username]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="30" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="30" uuid="a3cdb99d-3bf6-4c66-b50c-259b9aabfaef"/>
<box leftPadding="3" rightPadding="3"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{User}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="625e4e5e-5057-4eab-b4a9-c5b22844d25c">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="e1c07cb8-a44c-4a8d-8566-5c86d6671282"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Reputation]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="30" rowSpan="1">
<textField pattern="#,##0">
<reportElement x="0" y="0" width="90" height="30" uuid="6be2d79f-be82-4c7b-afd9-0039fb8b3189"/>
<box leftPadding="3" rightPadding="3"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Rep}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</title>
</jasperReport>
Result in JasperStudio version 6.2
As you can see 3 pages (2 records on each, total record count 5).
I have data from DB as below.
Subject Mark Grade
---------
COMPUTER SCIENCE 88.00 A2
TAMIL 88.00 A2
HINDI 55.00 C1
MATHS 54.00 C1
SCIENCE 77.00 B1
ENGLISH 45.00 C2
Using Jasper Report I have to print it like this:
Subject COMPUTER SCIENCE Tamil HINDI MATHS SCIENCE ENGLISH
GRADE A2 A2 C1 C1 B1 C2
I put everything in detail band, but it prints like this
Subject COMPUTER SCIENCE COMPUTER SCIENCE COMPUTER SCIENCE
GRADE A2 A2 A2
Same repeated for all the subject, hence it prints 6 times into separate detail band for all subject, but I want it to be
Subject COMPUTER SCIENCE TAMIL HINDI
GRADE A2 A2 C1
Please do some suggestions? I have tried with column count, report count, expression, but with no result
This is achieved using crosstab, in your example there is no rowGroup so we need to generate a dummy rowGroup on fixed String "Grade", the columnGroup is on $F{Subject}
Example
<?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="grades" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="407ecd26-3880-4351-b7f4-4422fa5adc32">
<style name="Crosstab Data Text" hAlign="Center"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="Subject" class="java.lang.String"/>
<field name="Mark" class="java.lang.String"/>
<field name="Grade" class="java.lang.String"/>
<summary>
<band height="50">
<crosstab>
<reportElement x="0" y="0" width="555" height="50" uuid="c15de662-be8e-4db4-acef-1b71c3201725"/>
<crosstabHeaderCell>
<cellContents>
<staticText>
<reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="30" uuid="07cab0ef-f928-4681-86ff-0c38656cdd31"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Subject]]></text>
</staticText>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="dummy" width="70">
<bucket class="java.lang.String">
<bucketExpression><![CDATA["GRADE"]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25" uuid="0ec80ead-fa81-4933-b56b-445e14578f6b"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{dummy}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="Subject" height="30">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{Subject}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="62" height="30" uuid="304f31c2-426d-4177-aa32-bb7f6694cd6c"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Subject}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="GradeMeasure" class="java.lang.String">
<measureExpression><![CDATA[$F{Grade}]]></measureExpression>
</measure>
<crosstabCell width="62" height="25">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="62" height="25" uuid="b10eac33-96fb-4d5d-8c3f-212c72192a3c"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{GradeMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="dummy">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="26fc7a85-7738-45e8-81ff-e076bb51d3fd"/>
<textFieldExpression><![CDATA[$V{GradeMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="Subject">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="82d05499-1fe2-4a97-ad82-23fa974759c5"/>
<textFieldExpression><![CDATA[$V{GradeMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="dummy" columnTotalGroup="Subject">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="c6e4a9d8-6c74-4dcc-8617-18ad14e60890"/>
<textFieldExpression><![CDATA[$V{GradeMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
Result
I added a data source to my report in iReport Designer , I then dragged some "Text Field"s from the Report Elements palette to the Detail band and I got an error compiling a jasper report:
net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :
[jrc] 1. Field not found : deviceCostsDTO
even the field is declared:
<field name="deviceCostsDTO" class="com.domain.device.DeviceCostsDTO">
<fieldDescription><![CDATA[actionCostsDTO]]></fieldDescription>
</field>
and used here:
<frame>
<reportElement positionType="Float" x="0" y="155" width="802" height="60" isRemoveLineWhenBlank="true" />
<componentElement>
<reportElement x="0" y="36" width="802" height="24" isRemoveLineWhenBlank="true" />
<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="costsPerBeneficiaryDataset" >
<datasetParameter name="P_AC_DTO">
<datasetParameterExpression><![CDATA[$F{deviceCostsDTO}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="DOMAIN_CODE">
<datasetParameterExpression><![CDATA[$F{projectDomain}]]></datasetParameterExpression>
</datasetParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{costsPerBeneficiaryWrappers})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="24" width="802">
<frame>
<reportElement positionType="Float" x="0" y="0" width="802" height="24" isRemoveLineWhenBlank="true" />
<textField>
<reportElement x="0" y="0" width="69" height="24" />
<box leftPadding="5" rightPadding="5">
<topPen lineWidth="0.5" lineStyle="Solid"/>
<leftPen lineWidth="0.5" lineStyle="Solid"/>
<bottomPen lineWidth="0.5" lineStyle="Solid"/>
<rightPen lineWidth="0.5" lineStyle="Solid"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{beneficiaryShortName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="69" y="0" width="50" height="24" />
<box leftPadding="5" rightPadding="5">
<topPen lineWidth="0.5" lineStyle="Solid"/>
<leftPen lineWidth="0.5" lineStyle="Solid"/>
<bottomPen lineWidth="0.5" lineStyle="Solid"/>
<rightPen lineWidth="0.5" lineStyle="Solid"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="8"/>
</textElement>
<textFieldExpression class="java.lang.Long"><![CDATA[$F{numberOfPersonDays}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="119" y="0" width="50" height="24" />
<box leftPadding="5" rightPadding="5">
<topPen lineWidth="0.5" lineStyle="Solid"/>
<leftPen lineWidth="0.5" lineStyle="Solid"/>
<bottomPen lineWidth="0.5" lineStyle="Solid"/>
<rightPen lineWidth="0.5" lineStyle="Solid"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="8"/>
</textElement>
<textFieldExpression class="java.lang.Long"><![CDATA[((com.domain.device.DeviceCostsDTO)$F{deviceCostsDTO}).getTotalCostPerBeneficiary($F{applicantId})]]></textFieldExpression>
</textField>
</frame>
</jr:listContents>
</jr:list>
</componentElement>
</frame>
You're using this field inside a List. You should declare as a field of the dataset your list is using.
Like this:
<?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" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="testDataset">
<field name="testField" class="java.lang.String"/>
</subDataset>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="20" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="791" height="20"/>
<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="testDataset">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="791">
<textField>
<reportElement x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{testField}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>