Jasper Report Gouping doesnt work for subreport data - jasper-reports

I have a MAIN report and then a subreport that it is given the data from the MAIN report like this:
<subreport>
<reportElement x="0" y="0" width="555" height="224" uuid="b72a4572-ac0d-4a54-b57e-86e0420d1d94"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{sortedPositions})]]></dataSourceExpression>
<subreportExpression><![CDATA["/storage/intranet/balancing/templates/INVOICE_POSITIONS_PICASSO_TEMPLATE.jasper"]]></subreportExpression>
</subreport>
sortedPositions has the following fields
id
quantity
value
description
corridor
ProductConfiguration productConfiguration (another class)
When i try to group by any of the sortedPositions fileds the grouping doesn't work.
When i tried to book from the productConfiguration.field the grouping works!
The problem i that the field on which i want to group by is not in the productConfiguration and getting it directly from the sortedPositions doesn;t group as expected.
Here is the xml:
<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="INVOICE_POSITIONS_PICASSO_TEMPLATE" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="2e9314a9-2d41-428a-91e9-63a890b65110">
<property name="ireport.zoom" value="1.6105100000000019"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="quantity" class="java.math.BigDecimal"/>
<field name="id" class="java.lang.Long"/>
<field name="value" class="java.math.BigDecimal"/>
<field name="corridor" class="java.lang.String">
<fieldDescription><![CDATA[productConfiguration.invoicePositionList.get(0).corridor]]></fieldDescription>
</field>
<field name="description" class="java.lang.String"/>
<field name="productName" class="java.lang.String">
<fieldDescription><![CDATA[productConfiguration.product.name]]></fieldDescription>
</field>
<field name="invoiceConfigurationId" class="java.lang.Long">
<fieldDescription><![CDATA[productConfiguration.invoiceConfiguration.id]]></fieldDescription>
</field>
<field name="productDescription" class="java.lang.String">
<fieldDescription><![CDATA[productConfiguration.description]]></fieldDescription>
</field>
<field name="productConfigId" class="java.lang.Long">
<fieldDescription><![CDATA[productConfiguration.id]]></fieldDescription>
</field>
<field name="period" class="java.sql.Timestamp">
<fieldDescription><![CDATA[invoice.period]]></fieldDescription>
</field>
<variable name="sumValueFinal" class="java.math.BigDecimal" resetType="Group" resetGroup="ProductGroup" calculation="Sum">
<variableExpression><![CDATA[$F{value}.abs()]]></variableExpression>
</variable>
<group name="ProductGroup">
<groupExpression><![CDATA[$F{corridor}]]></groupExpression>
<groupFooter>
<band height="58">
<staticText>
<reportElement mode="Opaque" x="0" y="37" width="455" height="20" backcolor="#CCCCCC" uuid="87ce8c73-7c58-4775-87e4-307521c9f0fe"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9" isBold="true"/>
<paragraph rightIndent="2"/>
</textElement>
<text><![CDATA[Subtotal:]]></text>
</staticText>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="460" y="37" width="95" height="20" backcolor="#CCCCCC" uuid="5456221b-3dee-46fc-a9a4-999da7067898"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$V{sumValueFinal}.abs()]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="0" y="8" width="45" height="20" backcolor="#FFFFFF" uuid="e3207aed-06dc-4e00-9eac-adab729b841b"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9" isBold="true"/>
<paragraph rightIndent="2"/>
</textElement>
<text><![CDATA[GROUP FINAL]]></text>
</staticText>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="45" y="8" width="102" height="20" backcolor="#99FF99" uuid="e26a9f2a-b3c1-44df-b088-29f42dfea069"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{productName}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="455" y="8" width="95" height="20" backcolor="#99FF99" uuid="e1f7c353-c700-4d8a-9aa8-1c17c2c94743"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{value}.abs()]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="265" y="8" width="95" height="20" backcolor="#99FF99" uuid="7c9b2c7f-22c9-492f-a103-8047690a0080"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{corridor}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="360" y="8" width="95" height="20" backcolor="#99FF99" uuid="351f7355-61aa-4c38-a2e7-1250f965f2eb"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{quantity}.abs()]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="147" y="8" width="102" height="20" backcolor="#99FF99" uuid="3a2a9adb-2873-43e2-b8f5-48e3df353572"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{quantity}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
For reference the description -> NOT group correctly on the other hand the productDescription -> group correctly!

The issue was that the sortedPosition that i was "feeding" to the subreport wasn't properly and correctly sorted! Be careful the jasper group only makes one iteration through the data and the dataSource that you use for grouping should be sorted according what you want to group.

Related

Background image in the background band/detail band is being shown in design but not in preview and pdf in Jasper Studio [duplicate]

This question already has answers here:
iReport Import Background Image
(6 answers)
jasperreports: can see background image in pdf export but not in docx export
(3 answers)
Closed 2 years ago.
I have added Background Image by going to View -> Background Image
Below is my jrxml file
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Student_GradeCard" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1af80d91-9323-421a-9eaf-ed9c9f6e6975">
<property name="background.image.path" value="C:\path\BMSCELOGO.bmp"/>
<property name="background.image.widht" value="257"/>
<property name="background.image.height" value="193"/>
<property name="background.image.x" value="324"/>
<property name="background.image.y" value="182"/>
<queryString language="json">
<![CDATA[]]>
</queryString>
<field name="studentName" class="java.lang.String"/>
<field name="motherName" class="java.lang.String"/>
<field name="fatherName" class="java.lang.String"/>
<field name="USN" class="java.lang.String"/>
<field name="Semester" class="java.lang.String"/>
<field name="Session" class="java.lang.String"/>
<field name="SLNo" class="java.lang.Integer"/>
<field name="dateOfIssue" class="java.lang.String"/>
<field name="creditsRegistered" class="java.lang.Double"/>
<field name="creditsEarned" class="java.lang.Double"/>
<field name="SGPA" class="java.lang.Double"/>
<field name="cumulativeCreditsEarned" class="java.lang.Double"/>
<field name="CGPA" class="java.lang.Double"/>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="440" splitType="Stretch">
<frame>
<reportElement stretchType="ContainerHeight" x="0" y="0" width="800" height="396" uuid="a8145236-550e-4919-b555-04da6b0131c6">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<pen lineWidth="2.0" lineStyle="Solid" lineColor="#FA8816"/>
</box>
<frame>
<reportElement stretchType="ContainerHeight" x="12" y="12" width="779" height="374" uuid="e584ab75-ec26-4776-a40b-24dd6cd3f84a"/>
<box>
<pen lineWidth="4.0" lineStyle="Solid" lineColor="#FA8816"/>
</box>
<staticText>
<reportElement x="132" y="12" width="388" height="30" forecolor="#0000AF" uuid="e84730b8-3fe1-4b36-acdf-82953272cb85"/>
<textElement textAlignment="Center">
<font fontName="Lucida Bright" size="20" isBold="true"/>
</textElement>
<text><![CDATA[B M S COLLEGE OF ENGINEERING,]]></text>
</staticText>
<staticText>
<reportElement x="502" y="12" width="198" height="30" forecolor="#0000AF" uuid="052e2686-4fd5-4818-b2b6-679cc9eec4b4"/>
<textElement verticalAlignment="Middle">
<font fontName="Lucida Bright" size="14" isBold="true"/>
</textElement>
<text><![CDATA[BANGALORE - 560 019]]></text>
</staticText>
<staticText>
<reportElement x="136" y="42" width="566" height="16" forecolor="#0C20E2" uuid="53cf89c0-758d-4914-a6bf-0db81aff79b8"/>
<textElement textAlignment="Center">
<font size="10"/>
</textElement>
<text><![CDATA[(Autonomous College under Visvesvaraya Technological University, Belgaum)]]></text>
</staticText>
<staticText>
<reportElement x="134" y="60" width="566" height="18" forecolor="#0C20E2" uuid="4bfe2a96-5be6-4ad7-94fc-09a81c7af9fb"/>
<textElement textAlignment="Center">
<font size="12" isBold="false"/>
</textElement>
<text><![CDATA[Karnataka, India]]></text>
</staticText>
<staticText>
<reportElement x="136" y="80" width="564" height="30" forecolor="#E77817" uuid="031f1e54-be88-441a-928d-5f839427d775"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="18" isBold="true"/>
</textElement>
<text><![CDATA[GRADE CARD]]></text>
</staticText>
<staticText>
<reportElement x="139" y="102" width="562" height="30" forecolor="#FF0000" uuid="df1b9872-b463-4131-8fd1-15448bad61ac"/>
<textElement textAlignment="Center">
<font fontName="Times New Roman" size="17"/>
</textElement>
<text><![CDATA[Master of Technology]]></text>
</staticText>
<staticText>
<reportElement x="20" y="132" width="140" height="18" forecolor="#0C20E2" uuid="de0e642e-5342-425b-98ee-b92eb50cf702"/>
<textElement textAlignment="Left">
<font fontName="Times New Roman" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Name of the Student:]]></text>
</staticText>
<staticText>
<reportElement x="20" y="152" width="140" height="18" forecolor="#0C20E2" uuid="b45c1157-90ab-4310-8f50-dedbde39d398"/>
<textElement textAlignment="Left">
<font fontName="Times New Roman" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Name of the Mother:]]></text>
</staticText>
<staticText>
<reportElement x="20" y="172" width="140" height="18" forecolor="#0C20E2" uuid="bed17f85-0e82-4c23-b7e5-3dc0a5552cf3"/>
<textElement textAlignment="Left">
<font fontName="Times New Roman" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Name of the Father :]]></text>
</staticText>
<staticText>
<reportElement x="20" y="192" width="140" height="18" forecolor="#0C20E2" uuid="a04692a4-a492-497e-ab24-43ac459f331a"/>
<textElement textAlignment="Left">
<font fontName="Times New Roman" size="11" isBold="true"/>
</textElement>
<text><![CDATA[University Seat Number :]]></text>
</staticText>
<textField>
<reportElement x="162" y="132" width="136" height="18" forecolor="#A52378" uuid="f506bd82-b67d-41da-a92b-faea3410004b"/>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{studentName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="162" y="152" width="138" height="18" forecolor="#A52378" uuid="5dade759-f45d-4d14-af66-4474cd81e61d">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{motherName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="162" y="172" width="136" height="18" forecolor="#A52378" uuid="d22e56ec-d2ed-4cc8-a030-9edcc5c28d32">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{fatherName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="162" y="192" width="136" height="18" forecolor="#A52378" uuid="a9894ed8-2970-4bc6-8a48-6418282c16a5"/>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{USN}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement x="91" y="22" width="50" height="50" uuid="0acebf72-318c-4bce-86ec-8045378dae0e"/>
<imageExpression><![CDATA["C:\\path\\BMSCELOGO.bmp"]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement x="704" y="27" width="37" height="50" uuid="55def125-f8c7-4e19-86dc-23b8b4c8bbaf"/>
<imageExpression><![CDATA["C:\\path\\VTULOGO.bmp"]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement x="702" y="128" width="50" height="50" uuid="fd930389-8f40-4604-a32c-584c7b7b2614"/>
<imageExpression><![CDATA["C:\\path\\"+$F{USN}+".jpg"]]></imageExpression>
</image>
<staticText>
<reportElement x="480" y="154" width="68" height="18" forecolor="#0C20E2" uuid="f49e1d7b-00e6-4387-b76b-e6d04cb7b823"/>
<textElement textAlignment="Left">
<font fontName="Times New Roman" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Semester:]]></text>
</staticText>
<staticText>
<reportElement x="480" y="172" width="68" height="18" forecolor="#0C20E2" uuid="354978b8-fa85-4e1b-831b-7b7a6d9b5faa">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Left">
<font fontName="Times New Roman" size="11" isBold="true"/>
</textElement>
<text><![CDATA[Session :]]></text>
</staticText>
<textField>
<reportElement x="550" y="172" width="136" height="18" forecolor="#A52378" uuid="a5f88a4a-7375-484c-bbcb-180bb516ac8b"/>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Session}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="550" y="156" width="136" height="18" forecolor="#A52378" uuid="cecfb981-d018-419b-b661-f8936de3e6c1">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font fontName="Times New Roman" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Semester}]]></textFieldExpression>
</textField>
</frame>
</frame>
</band>
</detail>
</jasperReport>
The Image added through Palette is getting displayed but background Image added through View -> Background Image is not working.
** I have also added code to the background band but still the image doesn't show in the preview nor in the pdf **
jrxml with background band
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.13.0.final using JasperReports Library version 6.13.0-46ada4d1be8f3c5985fd0b6146f3ed44caed6f05 -->
<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="Student-GradeCard" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="82747cb6-07de-4c80-8914-8c3873f497a7">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="background.image.path" value="C:\Users\Sony\Desktop\BMSCE_Templates\LOGOS USED IN GC(UG,PG)\VCH1.bmp"/>
<property name="background.image.widht" value="771"/>
<property name="background.image.height" value="531"/>
<property name="background.image.x" value="40"/>
<property name="background.image.y" value="40"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band height="555" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</band>
</background>
</jasperReport>

empty columns in excel file while export from jasper

I am using jasper report 3.7.6. I have a list which i want to export to excel.I am able to export list into excel but there appears many hidden columns and rows in my excel.How to remove such hidden columns and rows?
My code is like this:
JasperPrint jasperPrint;
JRBeanCollectionDataSource beanCollectionDataSource=new JRBeanCollectionDataSource(lstScoreSheet);
String reportPath= FacesContext.getCurrentInstance().getExternalContext().getRealPath("/reports/[![enter image description here][1]][1]ScoreSheet.jasper");
jasperPrint=JasperFillManager.fillReport(reportPath, getParameters(batchYr),beanCollectionDataSource);
HttpServletResponse httpServletResponse1=(HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
httpServletResponse1.addHeader("Content-disposition", "attachment; filename=report.xls");
ServletOutputStream servletOutputStream=httpServletResponse1.getOutputStream();
JExcelApiExporter exporterXLS = new JExcelApiExporter();
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, servletOutputStream);
exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
exporterXLS.exportReport();
Image of excel file:
Here Column A,C,E.... are all empty and hidden .I want to remove those hidden columns.
My jrxml code is:
<?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="ScoreSheet" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="3.897434200000008"/>
<property name="ireport.x" value="2104"/>
<property name="ireport.y" value="122"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.column.width" value="100"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="detectCellType" value="true"/>
<property name="onePagePerSheet" value="false"/>
<property name="whitePageBackground" value="false"/>
<property name="ignoreGraphics" value="false"/>
<property name="collapseRowSpan" value="true"/>
<property name="ignoreCellBorder" value="true"/>
<property name="fontSizeFixEnabled" value="true"/>
<property name="maximumRowsPerSheet" value="0"/>
<parameter name="batchYear" class="java.lang.String"/>
<parameter name="date" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="advanceAccHT1" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccHT1]]></fieldDescription>
</field>
<field name="financialHT2" class="java.lang.String">
<fieldDescription><![CDATA[financialHT2]]></fieldDescription>
</field>
<field name="sn" class="java.lang.Integer">
<fieldDescription><![CDATA[sn]]></fieldDescription>
</field>
<field name="financialPT1" class="java.lang.String">
<fieldDescription><![CDATA[financialPT1]]></fieldDescription>
</field>
<field name="remarks" class="java.lang.String">
<fieldDescription><![CDATA[remarks]]></fieldDescription>
</field>
<field name="advanceAccHT2" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccHT2]]></fieldDescription>
</field>
<field name="auditHT2" class="java.lang.String">
<fieldDescription><![CDATA[auditHT2]]></fieldDescription>
</field>
<field name="advanceAccPT1" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccPT1]]></fieldDescription>
</field>
<field name="bcPT1" class="java.lang.String">
<fieldDescription><![CDATA[bcPT1]]></fieldDescription>
</field>
<field name="financialHT1" class="java.lang.String">
<fieldDescription><![CDATA[financialHT1]]></fieldDescription>
</field>
<field name="incomeHT2" class="java.lang.String">
<fieldDescription><![CDATA[incomeHT2]]></fieldDescription>
</field>
<field name="marketingPT1" class="java.lang.String">
<fieldDescription><![CDATA[marketingPT1]]></fieldDescription>
</field>
<field name="costHT2" class="java.lang.String">
<fieldDescription><![CDATA[costHT2]]></fieldDescription>
</field>
<field name="auditPT1" class="java.lang.String">
<fieldDescription><![CDATA[auditPT1]]></fieldDescription>
</field>
<field name="corporateHT1" class="java.lang.String">
<fieldDescription><![CDATA[corporateHT1]]></fieldDescription>
</field>
<field name="corporateHT2" class="java.lang.String">
<fieldDescription><![CDATA[corporateHT2]]></fieldDescription>
</field>
<field name="corporatePT1" class="java.lang.String">
<fieldDescription><![CDATA[corporatePT1]]></fieldDescription>
</field>
<field name="bcHT" class="java.lang.String">
<fieldDescription><![CDATA[bcHT]]></fieldDescription>
</field>
<field name="regNo" class="java.lang.String">
<fieldDescription><![CDATA[regNo]]></fieldDescription>
</field>
<field name="studentName" class="java.lang.String">
<fieldDescription><![CDATA[studentName]]></fieldDescription>
</field>
<field name="costHT1" class="java.lang.String">
<fieldDescription><![CDATA[costHT1]]></fieldDescription>
</field>
<field name="incomePT1" class="java.lang.String">
<fieldDescription><![CDATA[incomePT1]]></fieldDescription>
</field>
<field name="costPT1" class="java.lang.String">
<fieldDescription><![CDATA[costPT1]]></fieldDescription>
</field>
<field name="incomeHT1" class="java.lang.String">
<fieldDescription><![CDATA[incomeHT1]]></fieldDescription>
</field>
<field name="marketingHT" class="java.lang.String">
<fieldDescription><![CDATA[marketingHT]]></fieldDescription>
</field>
<field name="auditHT1" class="java.lang.String">
<fieldDescription><![CDATA[auditHT1]]></fieldDescription>
</field>
<field name="advanceAccPT2" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccPT2]]></fieldDescription>
</field>
<field name="auditPT2" class="java.lang.String">
<fieldDescription><![CDATA[auditPT2]]></fieldDescription>
</field>
<field name="corporatePT2" class="java.lang.String">
<fieldDescription><![CDATA[corporatePT2]]></fieldDescription>
</field>
<field name="financialPT2" class="java.lang.String">
<fieldDescription><![CDATA[financialPT2]]></fieldDescription>
</field>
<field name="costPT2" class="java.lang.String">
<fieldDescription><![CDATA[costPT2]]></fieldDescription>
</field>
<field name="bcPT2" class="java.lang.String">
<fieldDescription><![CDATA[bcPT2]]></fieldDescription>
</field>
<field name="marketingPT2" class="java.lang.String">
<fieldDescription><![CDATA[marketingPT2]]></fieldDescription>
</field>
<field name="incomePT2" class="java.lang.String">
<fieldDescription><![CDATA[incomePT2]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="49">
<staticText>
<reportElement x="262" y="0" width="273" height="16"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[ABC School]]></text>
</staticText>
<staticText>
<reportElement x="364" y="30" width="71" height="17"/>
<textElement textAlignment="Center">
<font size="11" isBold="true"/>
</textElement>
</staticText>
<staticText>
<reportElement x="337" y="16" width="124" height="16"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Score Sheet]]></text>
</staticText>
</band>
</title>
<detail>
<band height="16" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="19" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{sn}==0?null:$F{sn}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="18" y="0" width="119" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{studentName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="136" y="0" width="49" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{regNo}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="184" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{advanceAccHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="200" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{advanceAccHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="217" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{advanceAccPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="717" y="0" width="85" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{remarks}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="234" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{advanceAccPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="251" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{auditHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="268" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{auditHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="284" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{auditPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="300" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{auditPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="316" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{corporateHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="333" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{corporateHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="350" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{corporatePT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="367" y="0" width="20" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{corporatePT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="386" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{financialHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="403" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{financialHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="420" y="0" width="19" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{financialPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="438" y="0" width="21" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{financialPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="458" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{costHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="475" y="0" width="19" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{costHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="493" y="0" width="19" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{costPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="511" y="0" width="23" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{costPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="533" y="0" width="21" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{bcHT}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="553" y="0" width="21" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{bcPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="573" y="0" width="22" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{bcPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="594" y="0" width="20" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{marketingHT}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="613" y="0" width="20" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{marketingPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="700" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{incomePT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="683" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{incomePT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="666" y="0" width="18" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{incomeHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="632" y="0" width="19" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{marketingPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="650" y="0" width="17" height="16"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{incomeHT1}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
My jasper image :
UPDATED.
New question:
My row overlap problem
In this situation you must place text fields close to each other.
Look at 2 this examples :
1) In this example your excel export would be incorrect, like in your case.
2) In this example everything would be ok.
So, you need to change your template - field position as much as possible close to each other.
UPDATE
This is screenshots based on your code.
1) Your code.
2) My correction.
Can you see the difference between this two screenshots?
UPDATE 2
Try my correction :
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2016-08-17T14:43:37 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ScoreSheetCAPII" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b3b3e463-8dd6-416e-a615-42daac244b2a">
<property name="ireport.zoom" value="3.897434200000008"/>
<property name="ireport.x" value="2104"/>
<property name="ireport.y" value="122"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.column.width" value="100"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="detectCellType" value="true"/>
<property name="onePagePerSheet" value="false"/>
<property name="whitePageBackground" value="false"/>
<property name="ignoreGraphics" value="false"/>
<property name="collapseRowSpan" value="true"/>
<property name="ignoreCellBorder" value="true"/>
<property name="fontSizeFixEnabled" value="true"/>
<property name="maximumRowsPerSheet" value="0"/>
<parameter name="batchYear" class="java.lang.String"/>
<parameter name="date" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="advanceAccHT1" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccHT1]]></fieldDescription>
</field>
<field name="financialHT2" class="java.lang.String">
<fieldDescription><![CDATA[financialHT2]]></fieldDescription>
</field>
<field name="sn" class="java.lang.Integer">
<fieldDescription><![CDATA[sn]]></fieldDescription>
</field>
<field name="financialPT1" class="java.lang.String">
<fieldDescription><![CDATA[financialPT1]]></fieldDescription>
</field>
<field name="remarks" class="java.lang.String">
<fieldDescription><![CDATA[remarks]]></fieldDescription>
</field>
<field name="advanceAccHT2" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccHT2]]></fieldDescription>
</field>
<field name="auditHT2" class="java.lang.String">
<fieldDescription><![CDATA[auditHT2]]></fieldDescription>
</field>
<field name="advanceAccPT1" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccPT1]]></fieldDescription>
</field>
<field name="bcPT1" class="java.lang.String">
<fieldDescription><![CDATA[bcPT1]]></fieldDescription>
</field>
<field name="financialHT1" class="java.lang.String">
<fieldDescription><![CDATA[financialHT1]]></fieldDescription>
</field>
<field name="incomeHT2" class="java.lang.String">
<fieldDescription><![CDATA[incomeHT2]]></fieldDescription>
</field>
<field name="marketingPT1" class="java.lang.String">
<fieldDescription><![CDATA[marketingPT1]]></fieldDescription>
</field>
<field name="costHT2" class="java.lang.String">
<fieldDescription><![CDATA[costHT2]]></fieldDescription>
</field>
<field name="auditPT1" class="java.lang.String">
<fieldDescription><![CDATA[auditPT1]]></fieldDescription>
</field>
<field name="corporateHT1" class="java.lang.String">
<fieldDescription><![CDATA[corporateHT1]]></fieldDescription>
</field>
<field name="corporateHT2" class="java.lang.String">
<fieldDescription><![CDATA[corporateHT2]]></fieldDescription>
</field>
<field name="corporatePT1" class="java.lang.String">
<fieldDescription><![CDATA[corporatePT1]]></fieldDescription>
</field>
<field name="bcHT" class="java.lang.String">
<fieldDescription><![CDATA[bcHT]]></fieldDescription>
</field>
<field name="regNo" class="java.lang.String">
<fieldDescription><![CDATA[regNo]]></fieldDescription>
</field>
<field name="studentName" class="java.lang.String">
<fieldDescription><![CDATA[studentName]]></fieldDescription>
</field>
<field name="costHT1" class="java.lang.String">
<fieldDescription><![CDATA[costHT1]]></fieldDescription>
</field>
<field name="incomePT1" class="java.lang.String">
<fieldDescription><![CDATA[incomePT1]]></fieldDescription>
</field>
<field name="costPT1" class="java.lang.String">
<fieldDescription><![CDATA[costPT1]]></fieldDescription>
</field>
<field name="incomeHT1" class="java.lang.String">
<fieldDescription><![CDATA[incomeHT1]]></fieldDescription>
</field>
<field name="marketingHT" class="java.lang.String">
<fieldDescription><![CDATA[marketingHT]]></fieldDescription>
</field>
<field name="auditHT1" class="java.lang.String">
<fieldDescription><![CDATA[auditHT1]]></fieldDescription>
</field>
<field name="advanceAccPT2" class="java.lang.String">
<fieldDescription><![CDATA[advanceAccPT2]]></fieldDescription>
</field>
<field name="auditPT2" class="java.lang.String">
<fieldDescription><![CDATA[auditPT2]]></fieldDescription>
</field>
<field name="corporatePT2" class="java.lang.String">
<fieldDescription><![CDATA[corporatePT2]]></fieldDescription>
</field>
<field name="financialPT2" class="java.lang.String">
<fieldDescription><![CDATA[financialPT2]]></fieldDescription>
</field>
<field name="costPT2" class="java.lang.String">
<fieldDescription><![CDATA[costPT2]]></fieldDescription>
</field>
<field name="bcPT2" class="java.lang.String">
<fieldDescription><![CDATA[bcPT2]]></fieldDescription>
</field>
<field name="marketingPT2" class="java.lang.String">
<fieldDescription><![CDATA[marketingPT2]]></fieldDescription>
</field>
<field name="incomePT2" class="java.lang.String">
<fieldDescription><![CDATA[incomePT2]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="49">
<staticText>
<reportElement x="0" y="0" width="802" height="16" uuid="b3f33d10-d908-4673-bdac-ac2f62e1abfd"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[ABC School]]></text>
</staticText>
<staticText>
<reportElement x="0" y="32" width="802" height="17" uuid="0e00356f-d1a8-4165-9ebe-0a63c44c6a0a"/>
<textElement textAlignment="Center">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[CAP II Level]]></text>
</staticText>
<staticText>
<reportElement x="0" y="16" width="802" height="16" uuid="bde62bca-3aea-4354-bc85-fa45dcecaf2c"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Score Sheet]]></text>
</staticText>
</band>
</title>
<detail>
<band height="16" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="19" height="16" uuid="b5db95ef-b440-499a-a847-bd03fca30eda"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{sn}==0?null:$F{sn}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="19" y="0" width="117" height="16" uuid="183b3143-6880-4820-b530-dd62ca7d74c6"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{studentName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="136" y="0" width="48" height="16" uuid="d0a2e025-370c-40d3-b411-5f6fd5eed8fb"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{regNo}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="184" y="0" width="16" height="16" uuid="20c3c6b0-52c5-4124-81f7-5ed2064f9bbf"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{advanceAccHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="200" y="0" width="17" height="16" uuid="7cdf00f9-f69f-4167-9a9b-64410aa04397"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{advanceAccHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="217" y="0" width="16" height="16" uuid="f93971fd-aee2-4315-bea3-8df4a164ade8"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{advanceAccPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="717" y="0" width="85" height="16" uuid="8684224a-4ebe-44a2-82cb-0cbbab8020ee"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{remarks}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="233" y="0" width="18" height="16" uuid="04daeb6a-954d-46dd-843d-609ac0b2f453"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{advanceAccPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="251" y="0" width="17" height="16" uuid="842932fb-bd92-4d12-bb8e-25713df7db8b"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{auditHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="268" y="0" width="16" height="16" uuid="95cbcd97-be41-497d-b403-993600b5506f"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{auditHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="284" y="0" width="16" height="16" uuid="05c6721e-e7aa-4ef8-8a40-372a5050f661"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{auditPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="300" y="0" width="16" height="16" uuid="cd2cad02-67b7-4a54-abee-025c99183a83"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{auditPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="316" y="0" width="17" height="16" uuid="91d90809-18cd-4c88-b2d5-47fb630d3825"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{corporateHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="333" y="0" width="17" height="16" uuid="aa685841-a795-4e0e-bc1e-5b64e1fc1ae3"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{corporateHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="350" y="0" width="17" height="16" uuid="6ee0482c-3db7-4b00-9b73-c6e3d41572c2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{corporatePT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="367" y="0" width="19" height="16" uuid="190c08ce-84f7-4c73-9d12-a2985557ca33"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{corporatePT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="386" y="0" width="17" height="16" uuid="12b37691-dbf6-4d7c-94d9-67f2a60f0ec0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{financialHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="403" y="0" width="17" height="16" uuid="b77c3a90-d01c-4c8b-bce4-589b45e65361"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{financialHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="420" y="0" width="18" height="16" uuid="9328abd4-60fc-49ad-9dfd-e6428090cb14"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{financialPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="438" y="0" width="20" height="16" uuid="af7c037a-1cf9-4824-b7f8-7d4a1c908933"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{financialPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="458" y="0" width="17" height="16" uuid="9c42de03-c7a8-4401-be43-47b3eba26467"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{costHT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="475" y="0" width="19" height="16" uuid="05ee6a0e-8a98-4fe8-8468-d528f6525310"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{costHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="494" y="0" width="18" height="16" uuid="40fd7021-60d3-4b01-adf7-faac7228e2c2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{costPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="512" y="0" width="21" height="16" uuid="fccd0c9e-9106-46ef-af73-e5d23b7a2b20"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{costPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="533" y="0" width="20" height="16" uuid="65540391-9b31-4f54-9e87-4eb04b210b86"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{bcHT}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="553" y="0" width="20" height="16" uuid="ea8b1ae8-9421-437d-9012-89bfcb0d22dc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{bcPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="573" y="0" width="21" height="16" uuid="6a00db3f-7d10-4e31-96ca-7029668f6ede"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{bcPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="594" y="0" width="19" height="16" uuid="e3b69af2-b945-4e2b-ac06-1f691fab220a"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{marketingHT}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="613" y="0" width="19" height="16" uuid="e79789d6-30b1-4fd8-88d2-0231c2473e3b"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{marketingPT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="700" y="0" width="17" height="16" uuid="d901ebb0-2e6d-469a-b813-f9c8fc950026"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{incomePT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="683" y="0" width="17" height="16" uuid="f46ce9d6-2da3-4b0d-897d-b54cc992df37"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{incomePT1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="666" y="0" width="17" height="16" uuid="b08e937d-d1b7-42a7-83d0-b2e3965e7eff"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{incomeHT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="632" y="0" width="18" height="16" uuid="b7b95e62-c26f-4166-b971-ade1377e5bc1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{marketingPT2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="650" y="0" width="16" height="16" uuid="fa11ebb3-539a-4cb0-8c7b-b9a5073cd331"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{incomeHT1}]]></textFieldExpression>
</textField>
</band>
</detail>
Screenshot :

Removing blank entries from a Jasper report

I have created a report within the jrxml. I have specified to only print the details of each value if one of my fields is populated using the tag <printWhenExpression> with a value like so:
<textField>
<reportElement x="670" y="4" width="105" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>
This works in filtering only relevant data, however it leaves me with a lot of blank rows within the report. I have enabled the condition isRemoveLineWhenBlank="true" to remove these blank rows from being displayed on my report. This has taken my report from 12 pages to 5, however, I still observe a large number of empty rows within the report.
Here is a ScreenShot of my reports design in ireport.
And here is a ScreenShot of the report run (I've blanked out my company's name from the classes)
The full report 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="RIOBridgeReport" pageWidth="1530" pageHeight="842" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="10" rightMargin="5" topMargin="10" bottomMargin="10">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>
<parameter name="title" class="java.lang.String"/>
<parameter name="oneliner" class="java.lang.String"/>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[id[starts-with(.,'USCS')]]]></fieldDescription>
</field>
<field name="class" class="java.lang.String">
<fieldDescription><![CDATA[class]]></fieldDescription>
</field>
<field name="value" class="java.lang.String">
<fieldDescription><![CDATA[constructor-arg/value]]></fieldDescription>
</field>
<field name="value1" class="java.lang.String">
<fieldDescription><![CDATA[constructor-arg[1]/value]]></fieldDescription>
</field>
<field name="value2" class="java.lang.String">
<fieldDescription><![CDATA[constructor-arg[2]/value]]></fieldDescription>
</field>
<variable name="runDate" class="java.lang.String">
<initialValueExpression><![CDATA[new java.text.SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z").format(new java.util.Date())]]></initialValueExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="53" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="12" y="12" width="496" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{title} + " - " + $V{runDate}]]></textFieldExpression>
</textField>
<image>
<reportElement x="616" y="0" width="84" height="53"/>
<imageExpression><![CDATA["citi_corp_logo.gif"]]></imageExpression>
</image>
<textField isBlankWhenNull="true">
<reportElement x="12" y="32" width="496" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{oneliner}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="23" splitType="Stretch">
<staticText>
<reportElement x="12" y="2" width="85" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Bean Name]]></text>
</staticText>
<staticText>
<reportElement x="228" y="2" width="85" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Class]]></text>
</staticText>
<staticText>
<reportElement x="428" y="2" width="105" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Value]]></text>
</staticText>
<staticText>
<reportElement x="543" y="2" width="105" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Value1]]></text>
</staticText>
<staticText>
<reportElement x="670" y="2" width="105" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Value2]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="24">
<textField isBlankWhenNull="true">
<reportElement x="12" y="2" width="216" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="228" y="2" width="185" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{class}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="428" y="2" width="105" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="543" y="4" width="105" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="670" y="4" width="105" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>
</textField>
</band>
</detail>
<noData>
<band height="20">
<staticText>
<reportElement x="146" y="0" width="200" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="14" isBold="true"/>
</textElement>
<text><![CDATA[No data found]]></text>
</staticText>
</band>
</noData>
</jasperReport>
As you can see still a large amount of whitespace left within the report. Is there a way to completely remove them or push the blank rows to the end of the report.
Try placing everything inside a frame and add the "Remove line when blank" to the frame.
Instead of isRemoveLineWhenBlank for a field use the band properties of detail band. Therefore this condition should be put in the detail band properties printWhenExpression.
.

Formatting layout of Jasper report through iReport, to remove space between bands

I have the below report, developed using iReport 3.0 (we have to use this version because of system constraints). But no matter what I do, I can not get rid of the white space between the Page Header (addresses) and the Column Header.
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="customisation_summary" pageWidth="595" pageHeight="700" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true">
<style name="alternateStyle" isDefault="false" backcolor="#FFFFFF" fontName="Arial">
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue() % 2 == 0)]]></conditionExpression>
<style isDefault="false" style="alternateStyle" backcolor="#F7F7F7"/>
</conditionalStyle>
</style>
<parameter name="orderId" class="java.lang.String">
<defaultValueExpression><![CDATA[new Integer(0).toString()]]></defaultValueExpression>
</parameter>
<parameter name="REPORT_IMG_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\kukri\\workspaces\\sts_3_0_0\\clubshop\\clubshop\\src\\main\\webapp\\jasper\\images\\"]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\kukri\\workspaces\\sts_3_0_0\\clubshop\\clubshop\\src\\main\\webapp\\jasper\\"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT so.customer_id, so.order_date, so.order_ref, p.product_code, p.colour_code, p.name, SUM(soi.quantity) AS quantity, sz.size, '-' AS uom, '-' AS location, scc.unit_charge, SUM(soi.quantity * scc.unit_charge) total_charge
FROM sales_order AS so, sales_order_item AS soi, product AS p, stock AS st, size AS sz, stock_currency_charge AS scc
WHERE so.id = soi.order_id
AND soi.stock_id = st.id
AND st.product_id = p.id
AND st.id = scc.stock_id
AND st.size_id = sz.id
AND so.currency = scc.currency_code
AND so.id = '$P!{orderId}'
GROUP BY st.id
ORDER BY p.name, sz.display_seq]]>
</queryString>
<field name="customer_id" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="order_date" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="order_ref" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="product_code" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="colour_code" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="quantity" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="size" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="uom" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="location" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="unit_charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="total_charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<title>
<band height="72" isSplitAllowed="false">
<image onErrorType="Icon">
<reportElement key="image-4" x="-1" y="0" width="555" height="71"/>
<imageExpression class="java.lang.String"><![CDATA[$P{REPORT_IMG_DIR} + "//Top_Image.png"]]></imageExpression>
</image>
<staticText>
<reportElement x="307" y="51" width="247" height="20"/>
<textElement textAlignment="Right">
<font size="14"/>
</textElement>
<text><![CDATA[Order Customisation Pick Sheet]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="45">
<staticText>
<reportElement x="399" y="2" width="62" height="18"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Order Ref: ]]></text>
</staticText>
<textField>
<reportElement x="464" y="20" width="92" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression class="java.util.Date"><![CDATA[$F{order_date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="464" y="1" width="93" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{order_ref}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="399" y="20" width="62" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="10" isBold="true"/>
</textElement>
<text><![CDATA[Order Date: ]]></text>
</staticText>
<subreport>
<reportElement x="179" y="1" width="175" height="40"/>
<subreportParameter name="customer_id">
<subreportParameterExpression><![CDATA[$F{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customisation_jobsheet_summary_invaddy.jasper"]]></subreportExpression>
</subreport>
<subreport>
<reportElement x="0" y="0" width="175" height="40"/>
<subreportParameter name="customer_id">
<subreportParameterExpression><![CDATA[$F{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customisation_jobsheet_summary_del_addy.jasper"]]></subreportExpression>
</subreport>
</band>
</pageHeader>
<columnHeader>
<band height="20">
<staticText>
<reportElement mode="Opaque" x="23" y="1" width="79" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Product Code]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="463" y="1" width="39" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[UOM]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="178" y="1" width="231" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Product ]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="102" y="1" width="76" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Colour]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="409" y="1" width="26" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Size]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="435" y="1" width="28" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[QTY]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="501" y="1" width="55" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Location]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="2" y="1" width="21" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[#]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="19">
<textField>
<reportElement style="alternateStyle" isPrintRepeatedValues="false" x="21" y="1" width="79" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{product_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" isPrintRepeatedValues="false" x="176" y="1" width="231" height="18"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" isPrintRepeatedValues="false" x="100" y="1" width="76" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{colour_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="433" y="1" width="28" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{quantity}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="461" y="1" width="39" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{uom}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="499" y="1" width="55" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{location}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="1" width="21" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="407" y="1" width="26" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{size}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="50"/>
</columnFooter>
<summary>
<band height="80"/>
</summary>
</jasperReport>

Stretch with overflow Detail band not working as expected

I have a simple report. It has two bands title and detail.
In the Title I have a static text, in the Detail I have one textField.
The textField is set to stretchwithoverflow = "true". If I set the height for this field to fit one raw information, I get for the larger information one and a half rows. So one textField, in the textField I have 2 rows information, first row displayed correctly, second one - I can see a half height.
Can this be done? Expand only the rows that contain larger information and the larger information will fit well in the text field?
<?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="report7" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="15f9d2dd-21ce-41ec-bcb8-c1aca3a77e37">
<parameter name="EndDate" class="java.util.Date">
<defaultValueExpression><![CDATA[new java.util.Date()]]></defaultValueExpression>
</parameter>
<parameter name="Project" class="java.util.Collection"/>
<parameter name="Severity" class="java.util.Collection"/>
<parameter name="StartDate" class="java.util.Date">
<defaultValueExpression><![CDATA[new java.util.Date(112, 0, 01)]]></defaultValueExpression>
</parameter>
<parameter name="Project_Sets" class="java.util.Collection"/>
<queryString>
<![CDATA[some query]]>
</queryString>
<field name="crid" class="java.lang.String"/>
<field name="SEVER" class="java.lang.String"/>
<field name="product" class="java.lang.String"/>
<field name="state" class="java.lang.String"/>
<field name="status" class="java.lang.String"/>
<field name="submit_date" class="java.lang.String"/>
<field name="aging" class="java.lang.Long"/>
<title>
<band height="25" splitType="Stretch">
<staticText>
<reportElement uuid="63eef93a-7e8f-4c69-b9d6-4447fe90673d" x="0" y="0" width="555" height="25" forecolor="#3399FF"/>
<textElement textAlignment="Center">
<font size="16" isBold="true"/>
</textElement>
<text><![CDATA[Defects Aging]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="32">
<rectangle>
<reportElement uuid="9a2288d4-87ce-4ee7-b04e-267a7ee0ea8b" x="0" y="0" width="555" height="32" backcolor="#99CC00"/>
</rectangle>
<staticText>
<reportElement uuid="9281aa7a-4bcc-4456-9f25-83c7b2360a01" x="0" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[CRID]]></text>
</staticText>
<staticText>
<reportElement uuid="cacda134-069c-43ae-abc1-76f5c865df41" x="79" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Severity]]></text>
</staticText>
<staticText>
<reportElement uuid="d798786f-5ee0-4e76-8a35-2f908af6e92c" positionType="Float" x="158" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Product]]></text>
</staticText>
<staticText>
<reportElement uuid="6be4792d-01a5-4d18-940d-90f40417c7ad" positionType="Float" x="237" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[State]]></text>
</staticText>
<staticText>
<reportElement uuid="fa447ca9-121c-43fb-a7bf-1b29ada93adf" positionType="Float" x="316" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Status]]></text>
</staticText>
<staticText>
<reportElement uuid="b2d8f1db-871b-4e34-942f-b8c4a87a358b" positionType="Float" x="395" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Submit Date]]></text>
</staticText>
<staticText>
<reportElement uuid="c3eddc7c-25ca-4e29-a01e-13e856b67d03" x="474" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Days]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="81" splitType="Stretch">
<elementGroup>
<textField isStretchWithOverflow="true">
<reportElement uuid="6422c6d3-40b9-4e38-8bb4-ded91c91ac17" stretchType="RelativeToBandHeight" x="158" y="0" width="79" height="39"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{product}]]></textFieldExpression>
</textField>
</elementGroup>
</band>
</detail>
</jasperReport>
In the same band if there are more items and you want to have all same stretched. It has to be set to all of them to stretchType="RelativeToTallestObject" and isStretchWithOverflow="true".
<textField isStretchWithOverflow="true" pattern="###0">
<reportElement stretchType="RelativeToTallestObject" x="1576" y="0" width="91" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Long"><![CDATA[$F{count_tohfa}]]></textFieldExpression>
</textField>
Report property: Add this
net.sf.jasperreports.text.save.line = true
net.sf.jasperreports.export.html.wrap.break.word = true
Source: Word Wrapping HTML versus PDF