I am new at iReport. So I want to make a simple report based on data.
My problem is when my rows are less then detail band's size the whole table gets repeated in detail band, and I dont want it again. If my rows are aproximately 5, then same table gets copied 4 times in detail band, and not only table but each and every thing I put in detail band. It gets repeated itself till detail band limits come.
So am I making some mistake, or I have to set some property of detail band in iReport?
please help me friends. Thanks in advance.
This is the generated result:
Here is my code of jrxml:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport language="groovy" bottomMargin="20" topMargin="20" rightMargin="20" leftMargin="20" columnWidth="555"
whenNoDataType="AllSectionsNoDetail" pageHeight="842" pageWidth="595" name="test"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jasperreports.sourceforge.net/jasperreports">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineColor="#000000" lineWidth="1.0"/>
</box>
</style>
<style name="table_TH" backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table_CH" backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table_TD" backcolor="#FFFFFF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 1">
<box>
<pen lineColor="#000000" lineWidth="1.0"/>
</box>
</style>
<style name="table 1_TH" backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 1_CH" backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 1_TD" backcolor="#FFFFFF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 2">
<box>
<pen lineColor="#000000" lineWidth="1.0"/>
</box>
</style>
<style name="table 2_TH" backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 2_CH" backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 2_TD" backcolor="#FFFFFF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 3">
<box>
<pen lineColor="#000000" lineWidth="1.0"/>
</box>
</style>
<style name="table 3_TH" backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 3_CH" backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 3_TD" backcolor="#FFFFFF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 4">
<box>
<pen lineColor="#000000" lineWidth="1.0"/>
</box>
</style>
<style name="table 4_TH" backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 4_CH" backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 4_TD" backcolor="#FFFFFF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 5">
<box>
<pen lineColor="#000000" lineWidth="1.0"/>
</box>
</style>
<style name="table 5_TH" backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 5_CH" backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<style name="table 5_TD" backcolor="#FFFFFF" mode="Opaque">
<box>
<pen lineColor="#000000" lineWidth="0.5"/>
</box>
</style>
<subDataset name="a">
<parameter name="sem" class="java.lang.String">
<defaultValueExpression>
<![CDATA[]]>
</defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select final."M" as "ENROLLMENT",sem_batch.sem,sem_batch.batch,final."N" as "TTL_WKDY",final."O" as "PRESENT",round(((100*"O")/"N"),2) as "PERCENTAGE" from sem_batch, (select m."Std_id" as "M",l."Batch" as "L",l."Btch" as "N",m."Std" as "O" from (select count(b.batch_id) as "Btch",b.batch_id as "Batch" from batch_wkday b where b.batch_id like $P{sem} group by batch_id) l, (select count(a.std_id) as "Std",a.std_id as "Std_id",s.batch_id as "Batch" from attendance a,student_detail s where a.std_id=s.std_id and s.batch_id like $P{sem} group by a.std_id,s.batch_id) m where l."Batch"=m."Batch") final where final."L"=sem_batch.batch_id]]>
</queryString>
<field name="ENROLLMENT" class="java.math.BigDecimal"/>
<field name="SEM" class="java.math.BigDecimal"/>
<field name="BATCH" class="java.lang.String"/>
<field name="TTL_WKDY" class="java.math.BigDecimal"/>
<field name="PRESENT" class="java.math.BigDecimal"/>
<field name="PERCENTAGE" class="java.math.BigDecimal"/>
<group name="ENROLLMENT">
<groupExpression>
<![CDATA[$F{ENROLLMENT}]]>
</groupExpression>
</group>
</subDataset>
<parameter name="SEM" class="java.lang.String"/>
<queryString>
<![CDATA[select * from sem_batch]]>
</queryString>
<field name="SEM" class="java.math.BigDecimal"/>
<field name="BATCH" class="java.lang.String"/>
<field name="BATCH_ID" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch" height="69">
<staticText>
<reportElement height="53" width="421" y="0" x="68"/>
<textElement markup="none" textAlignment="Center">
<font size="22"/>
</textElement>
<text>
<![CDATA[ATTENDANCE - CLASS ]]>
</text>
</staticText>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band splitType="Stretch" height="61">
<staticText>
<reportElement height="20" width="53" y="0" x="0"/>
<textElement>
<font size="12"/>
</textElement>
<text>
<![CDATA[SEM]]>
</text>
</staticText>
<staticText>
<reportElement height="20" width="53" y="20" x="0"/>
<textElement>
<font size="12"/>
</textElement>
<text>
<![CDATA[DATE]]>
</text>
</staticText>
<staticText>
<reportElement height="20" width="10" y="0" x="58"/>
<textElement/>
<text>
<![CDATA[:]]>
</text>
</staticText>
<staticText>
<reportElement height="20" width="10" y="20" x="58"/>
<textElement/>
<text>
<![CDATA[:]]>
</text>
</staticText>
<textField pattern="dd/MM/yyyy">
<reportElement height="20" width="100" y="20" x="68"/>
<textElement/>
<textFieldExpression>
<![CDATA[new java.util.Date()]]>
</textFieldExpression>
</textField>
<textField>
<reportElement height="20" width="100" y="0" x="68"/>
<textElement/>
<textFieldExpression>
<![CDATA[$P{SEM}]]>
</textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band splitType="Stretch" height="125">
<componentElement>
<reportElement height="50" width="360" y="0" x="35" style="table 5" key="table 5"/>
<jr:table
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"
xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components">
<datasetRun subDataset="a">
<datasetParameter name="sem">
<datasetParameterExpression>
<![CDATA[$P{SEM}+'%']]>
</datasetParameterExpression>
</datasetParameter>
<connectionExpression>
<![CDATA[$P{REPORT_CONNECTION}]]>
</connectionExpression>
</datasetRun>
<jr:column width="118">
<jr:columnHeader height="23" style="table 5_CH" rowSpan="1">
<staticText>
<reportElement height="20" width="118" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="14" isBold="false"/>
</textElement>
<text>
<![CDATA[ENROLLMENT]]>
</text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" style="table 5_TD" rowSpan="1">
<textField>
<reportElement height="20" width="118" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression>
<![CDATA[$F{ENROLLMENT}]]>
</textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:columnHeader height="23" style="table 5_CH" rowSpan="1">
<staticText>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<text>
<![CDATA[SEM]]>
</text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" style="table 5_TD" rowSpan="1">
<textField>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="10"/>
</textElement>
<textFieldExpression>
<![CDATA[$F{SEM}]]>
</textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:columnHeader height="23" style="table 5_CH" rowSpan="1">
<staticText>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<text>
<![CDATA[BATCH]]>
</text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" style="table 5_TD" rowSpan="1">
<textField>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center"/>
<textFieldExpression>
<![CDATA[$F{BATCH}]]>
</textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:columnHeader height="23" style="table 5_CH" rowSpan="1">
<staticText>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<text>
<![CDATA[PRESENT]]>
</text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" style="table 5_TD" rowSpan="1">
<textField>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center"/>
<textFieldExpression>
<![CDATA[$F{PRESENT}]]>
</textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:columnHeader height="23" style="table 5_CH" rowSpan="1">
<staticText>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<text>
<![CDATA[PERCENTAGE]]>
</text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" style="table 5_TD" rowSpan="1">
<textField>
<reportElement height="20" width="90" y="0" x="0"/>
<textElement textAlignment="Center"/>
<textFieldExpression>
<![CDATA[$F{PERCENTAGE}]]>
</textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch" height="54">
<textField>
<reportElement height="20" width="100" y="16" x="227"/>
<textElement textAlignment="Center"/>
<textFieldExpression>
<![CDATA[$V{PAGE_NUMBER}]]>
</textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band splitType="Stretch" height="42"/>
</summary>
</jasperReport>
You should put the table component into the Title band (or into the Summary band, for example). Not into the Detail band.
Select Table Properties and add
printWhenExpression on the table to $V{REPORT_COUNT} == 1 Now to avoid repetation table values in your ireport.
Based on the previous answer response I was able with the table on the Detail section and the following properties set to avoid generating duplicated nor empty pages at the end of the document.
Detail Band -> set the Print When Expression with value $V{REPORT_COUNT} == 1
Table Element -> Set the Print When Expression $V{REPORT_COUNT} == 1
hey i got the solution of my problem. If in main query more than one rows are returned then such things will happen. Try to give query which returns not more than one row. Like "Select 1 from dual". This solution solved my problem.
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
I'm trying to understand how iReport works and how to create a simple jrxml file.
The report has a title and header and the data should be in a table. When I try to check how the report looks like using the preview button, I could see the title and header but not the table (Please note that I use that I clicked the "Use default value" for all fields). When I did not use the default value, I get this error.
Error filling print... net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : name
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : name
at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:809)
at net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:156)
at net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:400)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:151)
Caused by: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : name
at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:123)
at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:96)
at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:109)
Caused by: java.lang.NoSuchMethodException: Unknown property 'name' on class 'class java.lang.String'
at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1322)
at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:770)
at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:111)
... 15 more Print not filled. Try to use an EmptyDataSource...
I thought that maybe that problem has something to do with how I typed the data for List. Probably the format is wrong. This is how I typed the sample data
(myName, 5, Manila)
(Based on the screenshot, Is the format correct? I even tried enclosing it in a square bracket but I still get the same error.)
please note that I have 3 columns Name , Age , Address.
But in the error message I noticed this
Unknown property 'name' on class 'class java.lang.String'
which makes me think that I did something wrong when I create the dataset. (Sorry if I used a wrong term).
Anyway, here's the xml generated by iReport.
<?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="firstReport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="597c0716-df6b-42ec-a7c8-863eb1b7174a">
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#7FFFD4">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFFFEA">
<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>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#7FFFD4">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFFFEA">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Table Dataset 2" uuid="208e382c-09df-484e-8d2d-a4eb4f4e48ba">
<field name="name" class="java.lang.String"/>
<field name="age" class="java.lang.String"/>
<field name="address" class="java.lang.String"/>
</subDataset>
<parameter name="companyName" class="java.lang.String"/>
<parameter name="date" class="java.util.Date"/>
<parameter name="bean" class="java.util.List"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="32" splitType="Stretch">
<staticText>
<reportElement x="182" y="0" width="184" height="25" uuid="fe64d4b4-efb1-4ed2-ae06-772728fc8b65"/>
<textElement>
<font fontName="Bookman Old Style" size="15" isBold="true"/>
</textElement>
<text><![CDATA[Chart Of Account List]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="58" splitType="Stretch">
<staticText>
<reportElement x="13" y="0" width="100" height="20" uuid="52ae4669-b47e-408c-aabc-e8f470a1d92b"/>
<text><![CDATA[Company]]></text>
</staticText>
<staticText>
<reportElement x="13" y="38" width="100" height="20" uuid="a27fe0e1-9fe6-423f-a006-46c51c7e3e5e"/>
<text><![CDATA[Date Exported]]></text>
</staticText>
<textField>
<reportElement x="113" y="0" width="100" height="20" uuid="1d600fa2-9de4-4999-9222-98a8bcb484f9"/>
<textFieldExpression><![CDATA[$P{companyName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="113" y="38" width="100" height="20" uuid="1147b818-90ae-4b41-a757-19a590db41d7"/>
<textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement key="table 1" style="table 1" x="13" y="0" width="270" height="50" uuid="652523bf-b666-47bc-a1aa-fc20fb9e489a"/>
<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="Table Dataset 2" uuid="6fcb9950-2d3f-4752-b56d-df7bff1e6991">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{bean})]]></dataSourceExpression>
</datasetRun>
<jr:column width="90" uuid="ee62967c-3669-49fe-a70d-a588ae47439d">
<jr:columnHeader style="table 1_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="a0973bfe-815a-498e-8b25-c3320cfe0f62"/>
<text><![CDATA[Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="61d8309e-dd7d-4978-b171-9ae9144e2f5c"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="76a9e313-d134-420e-898b-7f5f444c4efb">
<jr:columnHeader style="table 1_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="f79fdf71-a673-4d3a-8e10-b986d99b8e9b"/>
<text><![CDATA[Age]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="e4342bed-af9c-4541-9e57-a24485d0a94d"/>
<textFieldExpression><![CDATA[$F{age}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="5c38c250-d74e-440c-93cb-3fef8ad38157">
<jr:columnHeader style="table 1_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="4656a074-f345-483a-971b-b00c95746ec0"/>
<text><![CDATA[Address]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="f2cc3d1c-97ef-48c1-b6e4-a12acc4e67ad"/>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
1) What is wrong with the jrxml that I made? Did I supply a wrong formatted data to the table? Or there's just something wrong with how I did the report?
This was fixed by adding "new" keyword in the datasource expression. You will see datasource expression by right clicking table in the Report Inspector. "edit Table Datasource"
I am a newbie to JasperReports. When I try to add values to table in the columns the column header and footer are getting repeated. How should I group column header.
My 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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="551344a1-61b0-419c-92a0-5ebe6f8d4219">
<property name="ireport.zoom" value="1.2100000000000004"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<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>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Table Dataset 1" uuid="75c6059a-1e76-45b2-a87c-14792e68956e">
<field name="training" class="java.lang.String"/>
<field name="trainingPeriod" class="java.lang.String"/>
<field name="traingingAdd" class="java.lang.String"/>
<field name="noofgovtorderauth" class="java.lang.String"/>
<field name="authapprovingentry" class="java.lang.String"/>
<field name="deptTestpassed" class="java.lang.String"/>
<field name="athConducTest" class="java.lang.String"/>
<field name="monthSptestPassed" class="java.lang.String"/>
<field name="yrSpTestPassed" class="java.lang.String"/>
<field name="regNo" class="java.lang.String"/>
</subDataset>
<parameter name="ReportName" class="java.lang.String"/>
<parameter name="Date" class="java.lang.String"/>
<parameter name="Title" class="java.lang.String"/>
<parameter name="SubTitle" class="java.lang.String"/>
<parameter name="FooterDetail" class="java.lang.String"/>
<parameter name="govtlogo" class="java.lang.String"/>
<parameter name="TNWRDLogo" class="java.lang.String"/>
<field name="training" class="java.lang.String">
<fieldDescription><![CDATA[training]]></fieldDescription>
</field>
<field name="trainingPeriod" class="java.lang.String"/>
<field name="traingingAdd" class="java.lang.String"/>
<field name="noofgovtorderauth" class="java.lang.String"/>
<field name="authapprovingentry" class="java.lang.String"/>
<field name="deptTestpassed" class="java.lang.String"/>
<field name="athConducTest" class="java.lang.String"/>
<field name="monthSptestPassed" class="java.lang.String"/>
<field name="yrSpTestPassed" class="java.lang.String"/>
<field name="regNo" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<frame>
<reportElement uuid="fd5eaed7-88e8-4980-8205-6e50cf99ef20" x="0" y="27" width="565" height="52">
<property name="net.sf.jasperreports.export.pdf.tag.h1"/>
<property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.th" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
</reportElement>
<box>
<pen lineWidth="0.25"/>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textField>
<reportElement uuid="d3615141-0461-4665-b5f4-46a10f968d0e" x="174" y="33" width="213" height="19"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{SubTitle}]]></textFieldExpression>
</textField>
<image>
<reportElement uuid="34b5159e-3eb2-450a-9536-f79813589d48" x="442" y="2" width="61" height="48"/>
<imageExpression><![CDATA[$P{TNWRDLogo}]]></imageExpression>
</image>
<image>
<reportElement uuid="cd0f7d86-105f-44a1-8c27-81feacfba469" x="65" y="0" width="98" height="51"/>
<imageExpression><![CDATA[$P{govtlogo}]]></imageExpression>
</image>
<textField>
<reportElement uuid="e8aee322-2336-4637-9a5c-cb51af5995c8" x="174" y="0" width="213" height="32"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch">
<textField>
<reportElement uuid="4c89127c-2b66-447e-af83-7ffd210e8a19" x="174" y="5" width="213" height="24"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression>
</textField>
<frame>
<reportElement uuid="4ba70858-74c9-48a0-9690-888636570607" x="0" y="0" width="565" height="35"/>
<box>
<pen lineWidth="0.25"/>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
</frame>
</band>
</pageHeader>
<columnHeader>
<band height="23" splitType="Stretch">
<staticText>
<reportElement uuid="479cad61-a5be-4318-8e81-850ba6626e59" x="27" y="0" width="100" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Training Detail]]></text>
</staticText>
<staticText>
<reportElement uuid="d3474389-b724-4579-81b6-2f5c806aaa25" x="432" y="0" width="100" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Special Tests Passed]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="f2abf631-2415-4ba1-bf93-4b1d458dacbc" key="table 2" style="table 2" x="53" y="44" width="450" height="50"/>
<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="Table Dataset 1" uuid="69dfdbc6-34fc-48ee-8ecd-197cde9b11fb">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:columnGroup width="450" uuid="7287994d-bc5c-4286-8607-29969a2eb9ef">
<jr:column width="90" uuid="dbd24c78-fb82-47c4-9342-d5a73fb7e000">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="74b27263-d281-4136-b674-12bd3a74bd3c" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Training]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="be34b5c1-5cd4-43e3-b6f9-0e6f2bbf88db" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{training}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="01a9c90b-46c3-4693-b186-7abc77256f73">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="5ada3627-2084-4d79-a923-b6acbeee8058" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Period / Duration]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="abb64036-38ea-4560-84fd-09dde730c3bc" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{trainingPeriod}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="0865e4a3-5dbe-430a-9c50-90a636ef49ef">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="a897110e-f09f-43f3-a53b-aa8450065832" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Impart Training Address]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="41f45483-1f6d-480c-a59c-96093111ace5" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{traingingAdd}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="8949efe8-7041-49dd-8631-685e8568e6d5">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="643bb124-0b66-448d-ade8-c7b540f18eb5" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[No of Government Orders]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="834227d7-673a-4335-b1f8-37b3892125b1" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{noofgovtorderauth}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="7fa15b45-3110-4648-ab41-35fc77c625d6">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="cfd20c24-75f4-449e-83ae-38d9e0507728" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[ Approving Audthority]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="b5e5dec0-46d3-47b5-aefe-5fe2038c94b9" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{authapprovingentry}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
</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>
Try this , It will work for you.
<?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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="551344a1-61b0-419c-92a0-5ebe6f8d4219">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<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>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Table Dataset 1" uuid="75c6059a-1e76-45b2-a87c-14792e68956e">
<field name="training" class="java.lang.String"/>
<field name="trainingPeriod" class="java.lang.String"/>
<field name="traingingAdd" class="java.lang.String"/>
<field name="noofgovtorderauth" class="java.lang.String"/>
<field name="authapprovingentry" class="java.lang.String"/>
<field name="deptTestpassed" class="java.lang.String"/>
<field name="athConducTest" class="java.lang.String"/>
<field name="monthSptestPassed" class="java.lang.String"/>
<field name="yrSpTestPassed" class="java.lang.String"/>
<field name="regNo" class="java.lang.String"/>
</subDataset>
<parameter name="ReportName" class="java.lang.String"/>
<parameter name="Date" class="java.lang.String"/>
<parameter name="Title" class="java.lang.String"/>
<parameter name="SubTitle" class="java.lang.String"/>
<parameter name="FooterDetail" class="java.lang.String"/>
<parameter name="govtlogo" class="java.lang.String"/>
<parameter name="TNWRDLogo" class="java.lang.String"/>
<field name="training" class="java.lang.String">
<fieldDescription><![CDATA[training]]></fieldDescription>
</field>
<field name="trainingPeriod" class="java.lang.String"/>
<field name="traingingAdd" class="java.lang.String"/>
<field name="noofgovtorderauth" class="java.lang.String"/>
<field name="authapprovingentry" class="java.lang.String"/>
<field name="deptTestpassed" class="java.lang.String"/>
<field name="athConducTest" class="java.lang.String"/>
<field name="monthSptestPassed" class="java.lang.String"/>
<field name="yrSpTestPassed" class="java.lang.String"/>
<field name="regNo" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="114" splitType="Stretch">
<frame>
<reportElement uuid="fd5eaed7-88e8-4980-8205-6e50cf99ef20" x="0" y="27" width="565" height="52">
<property name="net.sf.jasperreports.export.pdf.tag.h1"/>
<property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.th" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
</reportElement>
<box>
<pen lineWidth="0.25"/>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textField>
<reportElement uuid="d3615141-0461-4665-b5f4-46a10f968d0e" x="174" y="33" width="213" height="19"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{SubTitle}]]></textFieldExpression>
</textField>
<image>
<reportElement uuid="34b5159e-3eb2-450a-9536-f79813589d48" x="442" y="2" width="61" height="48"/>
<imageExpression><![CDATA[$P{TNWRDLogo}]]></imageExpression>
</image>
<image>
<reportElement uuid="cd0f7d86-105f-44a1-8c27-81feacfba469" x="65" y="0" width="98" height="51"/>
<imageExpression><![CDATA[$P{govtlogo}]]></imageExpression>
</image>
<textField>
<reportElement uuid="e8aee322-2336-4637-9a5c-cb51af5995c8" x="174" y="0" width="213" height="32"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch">
<textField>
<reportElement uuid="4c89127c-2b66-447e-af83-7ffd210e8a19" x="174" y="5" width="213" height="24"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression>
</textField>
<frame>
<reportElement uuid="4ba70858-74c9-48a0-9690-888636570607" x="0" y="0" width="565" height="35"/>
<box>
<pen lineWidth="0.25"/>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
</frame>
</band>
</pageHeader>
<columnHeader>
<band height="23" splitType="Stretch">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
<staticText>
<reportElement uuid="479cad61-a5be-4318-8e81-850ba6626e59" x="27" y="0" width="100" height="22">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Training Detail]]></text>
</staticText>
<staticText>
<reportElement uuid="d3474389-b724-4579-81b6-2f5c806aaa25" x="432" y="0" width="100" height="22">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Special Tests Passed]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="f2abf631-2415-4ba1-bf93-4b1d458dacbc" key="table 2" style="table 2" x="53" y="44" width="450" height="50"/>
<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="Table Dataset 1" uuid="69dfdbc6-34fc-48ee-8ecd-197cde9b11fb">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:columnGroup uuid="7287994d-bc5c-4286-8607-29969a2eb9ef" width="450">
<jr:column uuid="dbd24c78-fb82-47c4-9342-d5a73fb7e000" width="90">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="74b27263-d281-4136-b674-12bd3a74bd3c" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Training]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="be34b5c1-5cd4-43e3-b6f9-0e6f2bbf88db" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{training}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="01a9c90b-46c3-4693-b186-7abc77256f73" width="90">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="5ada3627-2084-4d79-a923-b6acbeee8058" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Period / Duration]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="abb64036-38ea-4560-84fd-09dde730c3bc" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{trainingPeriod}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="0865e4a3-5dbe-430a-9c50-90a636ef49ef" width="90">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="a897110e-f09f-43f3-a53b-aa8450065832" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Impart Training Address]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="41f45483-1f6d-480c-a59c-96093111ace5" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{traingingAdd}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="8949efe8-7041-49dd-8631-685e8568e6d5" width="90">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="643bb124-0b66-448d-ade8-c7b540f18eb5" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[No of Government Orders]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="834227d7-673a-4335-b1f8-37b3892125b1" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{noofgovtorderauth}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="7fa15b45-3110-4648-ab41-35fc77c625d6" width="90">
<jr:columnHeader style="table 2_CH" height="29" rowSpan="1">
<staticText>
<reportElement uuid="cfd20c24-75f4-449e-83ae-38d9e0507728" x="0" y="0" width="90" height="29"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[ Approving Audthority]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 2_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="b5e5dec0-46d3-47b5-aefe-5fe2038c94b9" x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{authapprovingentry}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
</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>
Enjoy....
The standard column layout can use to achieve this. How can I do it for the table component layout?
It is quite easy. You should add new datasource for Table component and then use it (datasource) in this component.
The sample jrxml:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport ... whenNoDataType="AllSectionsNoDetail" ...>
<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">
<queryString language="SQL">
<![CDATA[SELECT id, city, street FROM address ORDER BY city]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="CITY" class="java.lang.String"/>
<field name="STREET" class="java.lang.String"/>
<group name="CITY">
<groupExpression><![CDATA[$F{CITY}]]></groupExpression>
</group>
</subDataset>
<title>
<band height="58" splitType="Stretch">
<componentElement>
<reportElement key="table" style="table" x="0" y="0" width="299" height="46"/>
<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">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="90">
<jr:groupHeader groupName="CITY">
<jr:cell height="30" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>
</textField>
</jr:cell>
</jr:groupHeader>
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[Id]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[Street]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{STREET}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</title>
</jasperReport>
The design in iReport looks like this:
The main report view:
The Table component view:
In this sample I've delete the main datasource and put the Table component to the Title band. I've set whenNoDataType="AllSectionsNoDetail" property for displaying report.
The data in report is grouped by city field.
The iReport is generating multiple (identical) tables for the query I am submitting.
I am trying to extract all data from the manga DB table into a Table component. I successfully does so but is creating multiple tables with the same data.
<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="mangaReport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="43bb2d5b-ad44-48ca-bcc9-bec319a36466">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<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>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="New Dataset 1" uuid="820ac89b-615e-453d-9593-9deeb8c44a87">
<queryString language="SQL">
<![CDATA[select * from manga]]>
</queryString>
<field name="name" class="java.lang.String"/>
<field name="author" class="java.lang.String"/>
</subDataset>
<queryString language="SQL">
<![CDATA[select * from manga]]>
</queryString>
<field name="name" class="java.lang.String"/>
<field name="author" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="39" splitType="Stretch"/>
</title>
<pageHeader>
<band height="18" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="31" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="4f76c19e-e304-45b3-a521-b30aa4ecb03e" key="table 1" style="table 1" x="185" y="34" width="360" height="50"/>
<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="New Dataset 1" uuid="9f479053-64b3-49a7-a986-2415ac20385f">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column uuid="5b10c367-6de0-4799-8408-ad8c7dadd888" width="90">
<jr:columnHeader style="table 1_CH" height="30">
<staticText>
<reportElement uuid="7470c697-d500-46e0-88c1-d42883576ef1" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20">
<textField>
<reportElement uuid="32a30162-dca0-4bda-8ef2-ae8f41d4340a" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="3f6fac9d-5a87-4fee-ac81-51170b6d7481" width="90">
<jr:columnHeader style="table 1_CH" height="30">
<staticText>
<reportElement uuid="21335524-5b94-464b-83fc-36d7734596e4" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[author]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20">
<textField>
<reportElement uuid="9765da67-b578-4bc3-b0f4-5878c64b9e66" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{author}]]></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>
I tried to search the forums but couldn't find the solution.
Please advice
The reason of this issue that JR engine iterates the table twice - first time using the main datasource (report's datasource) with Detail band and the second time with Table component's datasource.
You can delete the main datasource and put the Table component to the Summary band, for example.
In this case your template will be like this:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport .. whenNoDataType="AllSectionsNoDetail" ..>
<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>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="New Dataset 1" uuid="820ac89b-615e-453d-9593-9deeb8c44a87">
<queryString language="SQL">
<![CDATA[select name, author from address]]>
</queryString>
<field name="name" class="java.lang.String"/>
<field name="author" class="java.lang.String"/>
</subDataset>
<title>
<band height="39" splitType="Stretch"/>
</title>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<summary>
<band height="63" splitType="Stretch">
<componentElement>
<reportElement uuid="4f76c19e-e304-45b3-a521-b30aa4ecb03e" key="table 1" style="table 1" x="131" y="0" width="360" height="50"/>
<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="New Dataset 1" uuid="9f479053-64b3-49a7-a986-2415ac20385f">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column uuid="5b10c367-6de0-4799-8408-ad8c7dadd888" width="90">
<jr:columnHeader style="table 1_CH" height="30">
<staticText>
<reportElement uuid="7470c697-d500-46e0-88c1-d42883576ef1" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20">
<textField>
<reportElement uuid="32a30162-dca0-4bda-8ef2-ae8f41d4340a" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column uuid="3f6fac9d-5a87-4fee-ac81-51170b6d7481" width="90">
<jr:columnHeader style="table 1_CH" height="30">
<staticText>
<reportElement uuid="21335524-5b94-464b-83fc-36d7734596e4" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[author]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table 1_TD" height="20">
<textField>
<reportElement uuid="9765da67-b578-4bc3-b0f4-5878c64b9e66" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{author}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
</jasperReport>
Do not forget to set whenNoDataType report's property as AllSectionsNoDetail in this case - to avoid the hiding Summary band.
Another way - you can remove Table component and use Detail band.
In this case the template will be like this:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport ...>
<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>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<queryString language="SQL">
<![CDATA[select name, author from address]]>
</queryString>
<field name="name" class="java.lang.String"/>
<field name="author" class="java.lang.String"/>
<title>
<band height="39" splitType="Stretch"/>
</title>
<columnHeader>
<band height="30">
<staticText>
<reportElement uuid="21335524-5b94-464b-83fc-36d7734596e4" style="table 1_CH" x="90" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[author]]></text>
</staticText>
<staticText>
<reportElement uuid="7470c697-d500-46e0-88c1-d42883576ef1" style="table 1_CH" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[name]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="9765da67-b578-4bc3-b0f4-5878c64b9e66" style="table 1_TD" x="90" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="32a30162-dca0-4bda-8ef2-ae8f41d4340a" style="table 1_TD" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{author}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>