Jasper report excel: isIgnorePagination doesn't work when dealing with jr:table - jasper-reports

I've created a report with table (jr:table), but when I am trying to export it as excel, pagination is not ignored(table headers are repeated, and table content breaks). I've added isIgnorePagination="true", but it doesn't help. How does ignore pagination for table content?

A possible workaround for this is to put a Print When Expression of
$V{PAGE_NUMBER} == 1
to the Row Properties of your Column Header.
<jr:columnHeader>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} == 1]]></printWhenExpression>
</jr:columnHeader>
Adding these properties to the report itself should take care of the rest:
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
And here is a working example:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.0.final using JasperReports Library version 6.19.0 -->
<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_10" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7e7f5a11-768e-423d-bc20-f349ad0f4a9b">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
<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="2431f4a9-44f8-4875-954d-2014e59501c6">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="common" class="java.lang.String"/>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="90" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="170" height="90" uuid="853b4734-645c-49cf-bced-50f32d372df9">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset1" uuid="603adceb-93c2-4ca7-872d-edcbeb4d71a4">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JsonDataSource(new URL("https://restcountries.com/v3.1/all").openStream(),"name")]]></dataSourceExpression>
</datasetRun>
<jr:column width="170" uuid="cd6c2544-09be-4dbc-9bf8-eacc64676e82">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableHeader style="Table_TH" height="30">
<staticText>
<reportElement x="0" y="0" width="170" height="30" uuid="695d454d-8542-4d13-a091-ea3c9096d4b9"/>
<text><![CDATA[Table Header]]></text>
</staticText>
</jr:tableHeader>
<jr:columnHeader style="Table_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="170" height="30" uuid="12ce7968-1c18-4875-ba98-c2d58032f878"/>
<text><![CDATA[Column Header]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="170" height="30" uuid="9d113dbd-8b30-43fb-8560-3dcd608d2967"/>
<textFieldExpression><![CDATA[$F{common}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:columnHeader>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} == 1]]></printWhenExpression>
</jr:columnHeader>
</jr:table>
</componentElement>
</band>
</title>
</jasperReport>

Related

How to send data to table component using node-jasper?

I have a task to generate PDFs with nodeJS, so i am working with the node-jasper library.
I try to display a table component but when i send dataset from back-end, it keeps showing empty table.
here is my nodjs code:
const express = require('express')
const app = express()
const port = 5000
var jasper = require('node-jasper')({
path: './lib/jasperreports-6.10.0',
reports: {
hw: {
jasper: './jasperFiles/repportBI.jasper',
jrxml: './reports/repportBI.jrxml',
conn: 'in_memory_json'
}
},
});
app.get('/jasper1', (req, res) => {
var report = {
report: 'hw',
data: {
title: "My test report",
Dataset1: jasper.toJsonDataSource(
{
dados: [
{
code: 'e1',
name: 'raouf',
function: 'Developer'
},
{
code: 'e2',
name: 'djamel',
function: 'Developer'
},
{
code: 'e3',
name: 'omar',
function: 'Medecine'
}
]
},
'dados'
),
}
,
dataset: { }
}
var pdf = jasper.pdf(report);
res.set({
'Content-type': 'application/pdf',
'Content-Length': pdf.length
});
res.send(pdf)
});
app.listen(port, () => {
console.log('app is runing on port: ', port)
})
here is my jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.10.0.final using JasperReports Library version 6.10.0-unknown -->
<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="repportBI" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="95744304-ed70-4001-8031-6cec31c7acbf">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_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 1_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="70370722-01b1-41a5-a681-3d6a28fa2f84">
<queryString>
<![CDATA[]]>
</queryString>
<field name="code" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="function" class="java.lang.String"/>
</subDataset>
<parameter name="title" class="java.lang.String"/>
<parameter name="datasetTable1" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="code" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="function" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="90" splitType="Stretch">
<textField>
<reportElement x="204" y="6" width="147" height="60" uuid="4fc37721-d03e-4f94-9df8-355d2c2ed4e3"/>
<textElement textAlignment="Center">
<font size="26" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{title}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="354" splitType="Stretch">
<componentElement>
<reportElement x="72" y="154" width="200" height="200" uuid="99067366-d9e3-48e1-95b3-a4d8c1e8a1db">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 1_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 1_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table 1_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Dataset1" uuid="7f03ad97-fa43-4b82-94c5-19a674ac7d7e">
<dataSourceExpression><![CDATA[$P{datasetTable1}]]></dataSourceExpression>
</datasetRun>
<jr:column width="66" uuid="40fb6564-12c3-4174-955c-23d808832359">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne1"/>
<jr:columnHeader style="Table 1_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="66" height="30" uuid="a6e64620-475b-4cd5-a3f6-d7dd711b2ee2"/>
<text><![CDATA[code]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField>
<reportElement x="0" y="0" width="66" height="30" uuid="a7d15e3a-2452-4f80-8c20-7fbcc8181fe0"/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="66" uuid="ba0efa7e-7795-4fd2-9b71-b39f9fdcb466">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne2"/>
<jr:columnHeader style="Table 1_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="66" height="30" uuid="a694b15b-401f-4e8d-a726-ac8e6ddcaf05"/>
<text><![CDATA[name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField>
<reportElement x="0" y="0" width="66" height="30" uuid="b0fe47b1-8a5c-4df3-8851-6e89da8bfc3a"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="66" uuid="d0dc532f-c2e6-4ff4-8b3e-7a8c8ab0a748">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne3"/>
<jr:columnHeader style="Table 1_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="66" height="30" uuid="32797f1c-a862-4e5f-b624-e1f19af58277"/>
<text><![CDATA[function]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField>
<reportElement x="0" y="0" width="66" height="30" uuid="ba092f73-109d-4160-b7dc-c664e83366c4"/>
<textFieldExpression><![CDATA[$F{function}]]></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 generated PDF:
enter image description here
i can't find where the problem is, can you help me please ?
There are two problems here.
The first is that the name of the parameter in report.data (namely Dataset1) doesn't match the name of the parameter in the report (which is datasetTable1). So you'll need this in the JavaScript code:
var report = {
report: 'hw',
data: {
title: "My test report",
datasetTable1: jasper.toJsonDataSource(
...
Then, the type of the datasetTable1 parameter in the report is net.sf.jasperreports.engine.data.JRBeanCollectionDataSource, while jasper.toJsonDataSource produces a net.sf.jasperreports.engine.data.JsonDataSource object. You need to set the parameter type to JsonDataSource or to a more generic type like this:
<parameter name="datasetTable1" class="net.sf.jasperreports.engine.JRDataSource"/>

How to to display list of values in rowgroup in a crosstab?

I'm unable to display list of values in crosstab rowgroup
I have this sample json
{
"header": {
"columnName": [
"Product Store1",
"location"
],
"values": [{
"purchase": {
"name": "bags",
"location": "MainMarket ",
"markets":["1","2","3"]
},
"weekSpend": [{
"weekStartDate": 20181105,
"spend": 100
},
{
"weekStartDate": 20181112,
"spend": 200
}
]
},
{
"purchase": {
"name": "shoes",
"location": "MainMarket ",
"markets":["a","b","c"]
},
"weekSpend": [{
"weekStartDate": 20181105,
"spend": 100
},
{
"weekStartDate": 20181112,
"spend": 200
}
]
}
]
}
i want to show the output of market as row group as list of values Following this post jasper map crosstab crosstabHeaderCell from subdataset different from crosstabdataset
I created crosstab parameter
<crosstabParameter name="listDS" class="net.sf.jasperreports.engine.data.JsonQLDataSource">
<parameterValueExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("purchase.markets")]]></parameterValueExpression>
</crosstabParameter>
then referenced this list in row group like this
<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="listSubDataset" uuid="b7fb45d8-2511-483e-9967-dd7efd283a1b">
<dataSourceExpression><![CDATA[$P{listDS}]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="85" width="70">
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="672350d1-e69e-4ef3-a9da-c36d66646220"/>
<textFieldExpression><![CDATA[$F{colName}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
but the generated report displays market array as null
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<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="XTabReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="33c43d53-f9b3-4cc9-92b2-bedd805d66a9">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="json_crosstab/DataAdapter.xml"/>
<style name="Crosstab_CH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CG" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CT" mode="Opaque" backcolor="#005FB3">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="XTabDS" uuid="9911fa6c-61b7-4952-81bf-4666e3e17fcf">
<field name="weekStartDate" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
</field>
<field name="spend" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="spend"/>
</field>
<field name="name" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.purchase.name"/>
</field>
<field name="location" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.purchase.location"/>
</field>
</subDataset>
<subDataset name="listSubDataset" uuid="01e76955-f29e-4d52-991b-aa0149bfdb37">
<field name="colName" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="[0]"/>
</field>
</subDataset>
<queryString language="jsonql">
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="58">
<staticText>
<reportElement x="140" y="10" width="280" height="30" uuid="c8e3d7ad-eeb0-4cd1-8bef-88874e6921d4"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14"/>
</textElement>
<text><![CDATA[List inside Crosstab]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="30" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="70" splitType="Stretch">
<crosstab>
<reportElement x="0" y="0" width="560" height="70" uuid="79f2afae-ac8b-4442-ac8e-ae1b1f68109f">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.crosstab.style.header" value="Crosstab_CH"/>
<property name="com.jaspersoft.studio.crosstab.style.group" value="Crosstab_CG"/>
<property name="com.jaspersoft.studio.crosstab.style.total" value="Crosstab_CT"/>
<property name="com.jaspersoft.studio.crosstab.style.detail" value="Crosstab_CD"/>
</reportElement>
<crosstabParameter name="listDS" class="net.sf.jasperreports.engine.data.JsonQLDataSource">
<parameterValueExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("purchase.markets")]]></parameterValueExpression>
</crosstabParameter>
<crosstabDataset>
<dataset>
<datasetRun subDataset="XTabDS" uuid="73b2e155-5015-451a-8813-7e2ed2f731fb">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("..values..weekSpend.*")]]></dataSourceExpression>
</datasetRun>
</dataset>
</crosstabDataset>
<crosstabHeaderCell>
<cellContents>
<componentElement>
<reportElement x="0" y="0" width="180" height="30" isPrintWhenDetailOverflows="true" uuid="412c6db7-0cfa-4025-80cd-8c450f9eab96">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
</reportElement>
<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="Horizontal">
<datasetRun subDataset="listSubDataset" uuid="a911c80f-a0b3-4395-bbd7-2c52c67585d3">
<dataSourceExpression><![CDATA[$P{listDS}]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="90">
<textField>
<reportElement x="0" y="0" width="90" height="30" isPrintWhenDetailOverflows="true" uuid="168fd030-81cf-4b80-9766-6f4637c779ec"/>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
</box>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$F{colName}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="name" width="90" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{name}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="e8aa37d7-0921-40a6-8aca-1cccae61d26d"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{name}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<rowGroup name="location" width="90" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{location}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="86107a55-79be-4170-a2ee-b2a0ae5315e2"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{location}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="weekStartDate" height="30" totalPosition="End">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{weekStartDate}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="90" height="30" uuid="c65fb64a-d89b-4cc3-be28-d76624cb3d93"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{weekStartDate}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="spend_MEASURE" class="java.lang.Integer">
<measureExpression><![CDATA[$F{spend}]]></measureExpression>
</measure>
<crosstabCell width="90" height="20">
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="efb4b6dd-d9d3-4520-a94e-c0010a572b29"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{spend_MEASURE}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="20" columnTotalGroup="weekStartDate">
<cellContents/>
</crosstabCell>
<crosstabCell width="90" height="0" rowTotalGroup="location">
<cellContents/>
</crosstabCell>
<crosstabCell height="0" rowTotalGroup="location" columnTotalGroup="weekStartDate">
<cellContents/>
</crosstabCell>
<crosstabCell width="90" height="20" rowTotalGroup="name">
<cellContents/>
</crosstabCell>
<crosstabCell height="20" rowTotalGroup="name" columnTotalGroup="weekStartDate">
<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>
excepted output is
but actual output is

Why does table throws exception when contents of TextField in any of its column header cells grow larger than page height?

Jasperreports Studio throws a runtime error during preview when the contents of a table cell (Text field) is large. Important thing here is that the Text field need to have its Stretch With Overflow property set to True
Following is the exception thrown:
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Infinite loop creating new page due to column header overflow.
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Infinite loop creating new page due to column header overflow.
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnHeader(JRVerticalFiller.java:534)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:154)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:822)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:61)
at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This issue can be reproduced in multiple ways but I am using simplest scenario. I have attached simple jrxml file for reference. I have used a table with empty data set. I have used Text Field expression to display data. I have set isStretchWithOverflow to true.
JRXML
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<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="Table_Based" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="66519d71-4f27-4833-9a1d-c9b72e811f0c">
<property name="template.engine" value="tabular_template"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<style name="Title" fontName="Times New Roman" fontSize="50" isBold="true"/>
<style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/>
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
<style name="Row" mode="Transparent">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#E6DAC3"/>
</conditionalStyle>
</style>
<style name="Table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="Table_TH" mode="Opaque" backcolor="#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="tableDataset" uuid="bcc32bbf-2279-43e0-8149-66ee3e913b5e">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
</subDataset>
<subDataset name="Dataset1" uuid="13d74fad-eb9b-446f-a81d-55b8cf6ea0db">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="113" splitType="Stretch">
<staticText>
<reportElement style="Title" x="270" y="0" width="263" height="62" uuid="a080d2ca-6207-4d8e-87c9-d3b61fb495a9"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Report Title]]></text>
</staticText>
<staticText>
<reportElement style="SubTitle" x="303" y="62" width="196" height="22" uuid="0d849401-f944-4163-9df0-f69408a0618a"/>
<textElement>
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Report SubTitle]]></text>
</staticText>
</band>
</title>
<summary>
<band height="112" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.grid.JSSGridBagLayout"/>
<componentElement>
<reportElement stretchType="ContainerBottom" x="0" y="0" width="802" height="112" isPrintWhenDetailOverflows="true" uuid="f3767496-0434-4f42-862b-5839d580e423">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Dataset1" uuid="05c4f663-c370-4c53-b332-ae9dfb9590e0"/>
<jr:column width="170" uuid="a3e3c62f-3558-42a1-a701-ad31853970a9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="170" height="30" uuid="a5ddd2d9-992d-41d2-a7d0-4cc7ec29350b"/>
<textElement>
<font size="20"/>
</textElement>
<text><![CDATA[Number]]></text>
</staticText>
</jr:tableHeader>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<textField>
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="170" height="30" uuid="b4f24d97-8dbe-42e8-81a8-34fb336eabef"/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="40" rowSpan="1"/>
</jr:column>
<jr:column width="173" uuid="e2eaa014-ebfd-4795-b752-476ca2fa8f0b">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="173" height="30" uuid="b80ae7ce-3491-45cd-963d-8638f03a3891"/>
<textElement>
<font size="20"/>
</textElement>
<text><![CDATA[Text]]></text>
</staticText>
</jr:tableHeader>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="173" height="30" isPrintWhenDetailOverflows="true" uuid="a2647f94-9054-4efd-904e-0850eead4cdf"/>
<textElement>
<paragraph lineSpacing="1_1_2"/>
</textElement>
<textFieldExpression><![CDATA[UPPER("qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm")]]></textFieldExpression>
</textField>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="40">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
In similarly scenario Jasperreports server throws a different runtime exception:
It appears to be some kind of bug. Any help would be great help.
2018-09-21 17:03:26,667 ERROR RenderViewExceptionInterceptor,http-nio-8080-exec-8:55 - Internal server error occurred. Please contact your system administrator.
java.lang.NullPointerException
at net.sf.jasperreports.components.table.util.TableUtil.getAllColumns(TableUtil.java:162)
at net.sf.jasperreports.components.headertoolbar.json.HeaderToolbarElementJsonHandler.getColumnGroupsData(HeaderToolbarElementJsonHandler.java:832)
at net.sf.jasperreports.components.headertoolbar.json.HeaderToolbarElementJsonHandler.getJsonFragment(HeaderToolbarElementJsonHandler.java:237)
at net.sf.jasperreports.engine.export.JsonExporter.exportGenericElement(JsonExporter.java:487)
You need to redesign your report.
Currently you want a column header on each page, but your column header does not fit on page, so what happens is.
Create column header (because start of table or new page)
Break to new page (since it does not fit).
Go to 1 since new page.
net.sf.jasperreports.engine.JRRuntimeException: Infinite loop creating new page due to column header overflow.
Your solution can be all from making text smaller, column larger or truncate text so that it fits in page.

Use main report data for table in Jasper reports

Development IDE used : Jaspersoft Studio
I am trying to use main report datasource for table dataset by using the below expression but i am not getting any data.
Please advise on how to pass the datasource from report to table. I am new to jasper reports. Samples would be helpful.
JRXML:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.1.final using JasperReports Library version 6.2.1 -->
<!-- 2017-07-18T10:42:15 -->
<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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="62118ef8-810f-4b01-a13c-46539c328b0e">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="LendingTrustFee1_3_Json"/>
<style name="Title" fontName="Arial Unicode MS" fontSize="14"/>
<style name="SubTitle" forecolor="#736343" fontName="Arial Unicode MS" fontSize="11"/>
<style name="Column header" forecolor="#666666" fontName="Arial Unicode MS" fontSize="11"/>
<style name="Detail" fontName="Arial Unicode MS" fontSize="11" pdfEncoding="Identity-H"/>
<style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_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>
<style name="Table 1_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="TableDataset" uuid="b931bf1c-7487-4583-8af0-254967fef65f">
<queryString language="csv">
<![CDATA[]]>
</queryString>
<field name="ClientAndBenificiary" class="java.lang.String">
<fieldDescription><![CDATA[ClientAndBenificiary]]></fieldDescription>
</field>
<field name="DepartmentNameOfLender" class="java.lang.String">
<fieldDescription><![CDATA[DepartmentNameOfLender]]></fieldDescription>
</field>
<field name="TrustNoJapanese" class="java.lang.String">
<fieldDescription><![CDATA[TrustNoJapanese]]></fieldDescription>
</field>
<field name="ContractSignDate" class="java.sql.Date">
<fieldDescription><![CDATA[ContractSignDate]]></fieldDescription>
</field>
<field name="TrustNo" class="java.lang.String">
<fieldDescription><![CDATA[TrustNo]]></fieldDescription>
</field>
<field name="ReportStartDate" class="java.sql.Date">
<fieldDescription><![CDATA[ReportStartDate]]></fieldDescription>
</field>
<field name="EndStartDate" class="java.sql.Date">
<fieldDescription><![CDATA[EndStartDate]]></fieldDescription>
</field>
<field name="ReportPeriod" class="java.lang.String">
<fieldDescription><![CDATA[ReportPeriod]]></fieldDescription>
</field>
<field name="Currency" class="java.lang.String">
<fieldDescription><![CDATA[Currency]]></fieldDescription>
</field>
<field name="ShowLoanValue" class="java.lang.Boolean">
<fieldDescription><![CDATA[ShowLoanValue]]></fieldDescription>
</field>
<field name="ShowCleanPrice" class="java.lang.Boolean">
<fieldDescription><![CDATA[ShowCleanPrice]]></fieldDescription>
</field>
<field name="ShowAccruedInt" class="java.lang.Boolean">
<fieldDescription><![CDATA[ShowAccruedInt]]></fieldDescription>
</field>
<field name="ShowDirtyPrice" class="java.lang.Boolean">
<fieldDescription><![CDATA[ShowDirtyPrice]]></fieldDescription>
</field>
<field name="UDF1" class="java.lang.String">
<fieldDescription><![CDATA[UDF1]]></fieldDescription>
</field>
<field name="UDF2" class="java.lang.String">
<fieldDescription><![CDATA[UDF2]]></fieldDescription>
</field>
<field name="ReportFrequency" class="java.lang.String">
<fieldDescription><![CDATA[ReportFrequency]]></fieldDescription>
</field>
<field name="QtrReportStartDate" class="java.sql.Date">
<fieldDescription><![CDATA[QtrReportStartDate]]></fieldDescription>
</field>
<field name="QtrReportEndDate" class="java.sql.Date">
<fieldDescription><![CDATA[QtrReportEndDate]]></fieldDescription>
</field>
<field name="Securities_No_Mon1_3" class="java.lang.String">
<fieldDescription><![CDATA[Securities_No_Mon1_3]]></fieldDescription>
</field>
<field name="Lending_Fee_Mon1_3" class="java.math.BigDecimal">
<fieldDescription><![CDATA[Lending_Fee_Mon1_3]]></fieldDescription>
</field>
<field name="Trust_Fee_Mon1_3" class="java.math.BigDecimal">
<fieldDescription><![CDATA[Trust_Fee_Mon1_3]]></fieldDescription>
</field>
<field name="Consumption_Tax_Mon1_3" class="java.math.BigDecimal">
<fieldDescription><![CDATA[Consumption_Tax_Mon1_3]]></fieldDescription>
</field>
<field name="Trust_Fee_Tax_Included_Mon1_3" class="java.math.BigDecimal">
<fieldDescription><![CDATA[Trust_Fee_Tax_Included_Mon1_3]]></fieldDescription>
</field>
<field name="SectionType" class="java.lang.String">
<fieldDescription><![CDATA[SectionType]]></fieldDescription>
</field>
<filterExpression><![CDATA[LEN($F{Securities_No_Mon1_3}) > 0]]></filterExpression>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="322" splitType="Stretch">
<componentElement>
<reportElement x="-1" y="0" width="551" height="220" uuid="3aaf3c11-1464-432e-a55d-fef0a54cfdaa">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 3_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 3_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table 3_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="TableDataset" uuid="75b0fbb9-805b-4e97-86e2-9a2688aae1ff">
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
</datasetRun>
<jr:column width="90" uuid="21ee4add-5a78-4c46-8ae3-1da6c6759a19">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement style="Detail" positionType="Float" x="0" y="0" width="90" height="30" uuid="575908d3-6ea1-4a84-a95c-985941866a21"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Securities_No_Mon1_3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="b5f25971-4c63-4094-ab6a-102adb70593e">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement style="Detail" positionType="Float" x="0" y="0" width="90" height="30" uuid="aa37293c-1ffc-48d3-a3f2-32abc83ebcb8"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Lending_Fee_Mon1_3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="96b8c9f2-b20f-4850-8702-aa4935cd496f">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement style="Detail" positionType="Float" x="0" y="0" width="80" height="30" uuid="0c059aad-8bf2-45c7-854f-c26bcdcbcb72"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Trust_Fee_Mon1_3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="70" uuid="4c69cb0c-bcd8-46a5-9ccc-f284fa037f14">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement style="Detail" positionType="Float" x="0" y="0" width="70" height="30" uuid="89d56faf-0773-4b1b-9229-08e2322e7650"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Consumption_Tax_Mon1_3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="170" uuid="1ff92af5-e2c2-4ab9-864a-73496dec702d">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement style="Detail" positionType="Float" x="0" y="0" width="170" height="30" uuid="1ecb2036-49d9-4337-b1de-2aa660e15bd6"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Trust_Fee_Tax_Included_Mon1_3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
Json Data:
[{"sectionType":"A","ClientAndBenificiary":"全国共済水産業協同組合連合会","DepartmentNameOfLender":"財務運用部 御中","TrustNoJapanese":"6018","ContractSignDate":"2013-04-23","TrustNo":"6018","ReportStartDate":"2016-07-01","EndStartDate":"2016-07-31","ReportPeriod":"2016-07-01から2016-07-31まで","Currency":"円","ShowLoanValue":"0","ShowCleanPrice":"0","ShowAccruedInt":"0","ShowDirtyPrice":"0","UDF1":"0.08","UDF2":"","ReportFrequency":"","QtrReportStartDate":"2016-07-01","QtrReportEndDate":"2016-08-01","Securities_No_Mon1_3":"JGB #289(10)Total","Lending_Fee_Mon1_3":"523645.000000000","Trust_Fee_Mon1_3":"174537.000000000","Consumption_Tax_Mon1_3":"13950.000000000","Trust_Fee_Tax_Included_Mon1_3":"188487.000000000","ReportLanguage":"ja","SectionType":"A"},{"sectionType":"A","ClientAndBenificiary":"全国共済水産業協同組合連合会","DepartmentNameOfLender":"財務運用部 御中","TrustNoJapanese":"6018","ContractSignDate":"2013-04-23","TrustNo":"6018","ReportStartDate":"2016-07-01","EndStartDate":"2016-07-31","ReportPeriod":"2016-07-01から2016-07-31まで","Currency":"円","ShowLoanValue":"0","ShowCleanPrice":"0","ShowAccruedInt":"0","ShowDirtyPrice":"0","UDF1":"0.08","UDF2":"","ReportFrequency":"","QtrReportStartDate":"2016-07-01","QtrReportEndDate":"2016-08-01","Securities_No_Mon1_3":"JGB #300(10)Total","Lending_Fee_Mon1_3":"268618.000000000","Trust_Fee_Mon1_3":"89529.000000000","Consumption_Tax_Mon1_3":"7148.000000000","Trust_Fee_Tax_Included_Mon1_3":"96677.000000000","ReportLanguage":"ja","SectionType":"A"},{"sectionType":"A","ClientAndBenificiary":"全国共済水産業協同組合連合会","DepartmentNameOfLender":"財務運用部 御中","TrustNoJapanese":"6018","ContractSignDate":"2013-04-23","TrustNo":"6018","ReportStartDate":"2016-07-01","EndStartDate":"2016-07-31","ReportPeriod":"2016-07-01から2016-07-31まで","Currency":"円","ShowLoanValue":"0","ShowCleanPrice":"0","ShowAccruedInt":"0","ShowDirtyPrice":"0","UDF1":"0.08","UDF2":"","ReportFrequency":"","QtrReportStartDate":"2016-07-01","QtrReportEndDate":"2016-08-01","Securities_No_Mon1_3":"JGB #305(10)Total","Lending_Fee_Mon1_3":"538950.000000000","Trust_Fee_Mon1_3":"179641.000000000","Consumption_Tax_Mon1_3":"14354.000000000","Trust_Fee_Tax_Included_Mon1_3":"193995.000000000","ReportLanguage":"ja","SectionType":"A"}]
I have added the JRXML and Json I am trying to load. When I pass dataSourceExpression in dataset I am getting only 2 rows but in source data there are three rows. Please help me to resolve this
For displaying data in table component in Jasper we need to setup new data set apart from main report data set. we can write any dummy query in main report data set like 'select 1 from dual;' in case database is mysql.

How to get rid extra space between rows in report?

I am new to JasperReports and I couldn't find a post here yet regarding extra space between rows. I have tried all possible combinations in the configuration but i still get that extra space.
Can someone point me in the right direction?
Here is my .jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 -->
<!-- 2014-09-24T10:15:09 -->
<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_Table_Based2" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="fc97a963-c0b6-4c19-a348-7e2773e092a3">
<property name="template.engine" value="tabular_template"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (8)"/>
<style name="Table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#EFEFEF">
<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="tableDataset" uuid="0a703f7e-a572-40e6-b9a7-1408781b7b0c">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (8)"/>
<queryString>
<![CDATA[]]>
</queryString>
<group name="Group1"/>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<field name="userId" class="java.lang.String"/>
<field name="userType" class="java.lang.String"/>
<title>
<band height="79" splitType="Stretch"/>
</title>
<columnHeader>
<band>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</band>
</columnHeader>
<detail>
<band height="40" splitType="Immediate">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField isBlankWhenNull="false">
<reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="20" y="20" width="100" height="20" isRemoveLineWhenBlank="true" uuid="bf862bec-5e45-4ac1-9d66-5a2e62e7007d"/>
<textFieldExpression><![CDATA[$F{userId}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="10" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</band>
</pageFooter>
<summary>
<band height="20" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</band>
</summary>
</jasperReport>