JRXML - Eliminating repeated header on the bottom - jasper-reports

We've got a problem when printing some PDF reports using JasperReports. These reports are basically a breakdown of all the sales made to a specific client over the course of the years.
We take information from a DB, transform it using Java, and print the reports in PDF. The problem is, in some rare cases, some headers appear repeated at the bottom of each page:
Ideally, we should be able to omit that loose header and keep only the one on the new page, but I can't seem to do it, at least via TIBCO Jaspersoft Studio.
I don't actually know much about these reports, but any information you need to help, feel free to ask.
Thanks in advance.
EDIT: Following Petter Friberg's comment, here's parts of the JRXML being used in this report. I omitted some parts that follow the same properties, but i think this should be clear enough.
<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="Historique" language="groovy" pageWidth="595" pageHeight="842" columnWidth="483" leftMargin="56" rightMargin="56" topMargin="43" bottomMargin="43" isSummaryWithPageHeaderAndFooter="true" resourceBundle="reportLabels" whenResourceMissingType="Empty" uuid="80db05e1-8ca3-483d-86cc-5947dc62296b">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="mm"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="mm"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="mm"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="mm"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<template><![CDATA["/jasper/styles_letter.jrtx"]]></template>
<style name="Table Group Header" mode="Opaque" forecolor="#000000" backcolor="#99CCFF" vTextAlign="Middle" fontName="Arial" fontSize="10" isBold="true" pdfFontName="Helvetica-Bold"/>
<!-- ... multiple styles -->
<parameter name="title" class="java.lang.String"/>
<!-- ... multiple parameters-->
<parameter name="addressCity" class="java.lang.String"/>
<field name="reduction" class="java.lang.String">
<fieldDescription><![CDATA[reduction]]></fieldDescription>
</field>
<!-- ... multiple fields -->
<field name="year" class="java.lang.String"/>
<group name="DescriptionGroup">
<groupExpression><![CDATA[$F{year}]]></groupExpression>
<groupHeader>
<band height="30">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<textField evaluationTime="Group" evaluationGroup="DescriptionGroup" bookmarkLevel="2">
<reportElement style="Table Group Header" mode="Opaque" x="0" y="0" width="483" height="15" printWhenGroupChanges="DescriptionGroup" backcolor="#B0B0B0" uuid="f626bb36-a919-48b9-98b3-756d1ce9812b">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<printWhenExpression><![CDATA[new Boolean($P{emptyList} != true)]]></printWhenExpression>
</reportElement>
<box leftPadding="10">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement markup="none">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{year}]]></textFieldExpression>
</textField>
<!-- ... multiple text fields following the same principle -->
</band>
</groupHeader>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<!-- this only appears in the first page, has all the customer info -->
</title>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="25" splitType="Stretch">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<textField pattern="" isBlankWhenNull="true">
<reportElement style="Zebra" mode="Opaque" x="0" y="0" width="130" height="25" uuid="234d3832-bd30-40a0-b8e5-eac964158000">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<printWhenExpression><![CDATA[new Boolean($P{emptyList} != true)]]></printWhenExpression>
</reportElement>
<textElement>
<font size="8" isBold="false"/>
<paragraph leftIndent="3"/>
</textElement>
<textFieldExpression><![CDATA[$F{article}]]></textFieldExpression>
</textField>
<!-- ... multiple fields following the same principle. this is the body of each sub-table, showing the info for each year -->
</band>
</detail>
<pageFooter>
<band height="25" splitType="Stretch">
<!-- ... -->
</band>
</pageFooter>
<summary>
<band height="40" splitType="Stretch">
<!-- ... shows a summary of all the info shown on each table -->
</band>
</summary>
</jasperReport>
Thanks in advance.

You are using a group the generate the header, so you can use this attribute minHeightToStartNewPage, to determine how much space needs to remain otherwise break to new page.
<group name="DescriptionGroup" minHeightToStartNewPage="60">
or if you like to force it to always start on new page
<group name="DescriptionGroup" isStartNewPage="true">

Related

How do I prevent text overflowing into the next cell in a Jasper Report that exports to Excel?

I am creating a jrxml in Jaspersoft Studio that exports a table to Excel. When I view the Excel output, the data in the last column is overflowing into the next cell like so:
I am trying to prevent the data from overflowing into the next cell without wrapping the data in the cell.
I was able to find a reference for why Excel does overflow text: https://www.ablebits.com/office-addins-blog/stop-text-spilling-over-excel/
One of the solutions is to manually Format Cells and change horizontal text alignment to 'Fill'. This gives me the following table, which is exactly what I need:
However, I was not able to find a way to configure my jrxml to obtain this behavior. How may I create my jrxml such that it will export to Excel without overflowing text into adjacent columns (without wrapping the text)?
I don't think text alignment 'Fill' can be set when exporting to XLS.
One (kinda dirty) solution is having a 'blank' cell next to COL2 which will prevent the text in COL2 overflowing into the 'blank' cell.
Your example (modified):
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.0.final using JasperReports Library version 6.1.1 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="240" pageHeight="400" columnWidth="200" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="af068097-e37b-4e41-9083-4c7b8e13c800">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="net.sf.jasperreports.export.xls.wrap.text" value="false"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<subDataset name="Dataset1" uuid="f12cc232-2035-43e1-b3e3-a446ee7318bf">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[select 'abcdefghijklmnopqrstuvwxyz' as data1,
'abcdefghijklmnopqrstuvwxyz' as data2]]>
</queryString>
<field name="data1" class="java.lang.String"/>
<field name="data2" class="java.lang.String"/>
</subDataset>
<queryString>
<![CDATA[select 1]]>
</queryString>
<detail>
<band height="359" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="220" height="60" uuid="6a7376a7-6ee6-4e94-8e7b-024170505320">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<c:table xmlns:c="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="0fee875c-6568-4a06-a8e4-f7fb34ebd4e5"/>
<c:column width="100" uuid="6517d845-8cbe-44b6-a644-cedfc40576c9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<c:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="100" height="30" forecolor="#FFFFFF" backcolor="#7845D9" uuid="f222fdba-a6db-46dd-97a5-e8e0181aa7e4">
<propertyExpression name="net.sf.jasperreports.export.xls.wrap.text"><![CDATA["true"]]></propertyExpression>
</reportElement>
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="1.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[COL1]]></text>
</staticText>
</c:columnHeader>
<c:detailCell height="30">
<textField isBlankWhenNull="true">
<reportElement mode="Opaque" x="0" y="0" width="100" height="30" uuid="2a235121-a4f3-487b-8138-edc5b5340e50"/>
<box>
<pen lineWidth="0.5"/>
</box>
<textElement verticalAlignment="Middle">
<paragraph leftIndent="3"/>
</textElement>
<textFieldExpression><![CDATA[$F{data1}]]></textFieldExpression>
</textField>
</c:detailCell>
</c:column>
<c:column width="100" uuid="23415ab5-ef42-4f13-9395-cc9bb019149a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<c:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="100" height="30" forecolor="#FFFFFF" backcolor="#7845D9" uuid="8ecbe731-1442-40b4-94a6-f3c57337704c">
<propertyExpression name="net.sf.jasperreports.export.xls.wrap.text"><![CDATA["true"]]></propertyExpression>
</reportElement>
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="1.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[COL2]]></text>
</staticText>
</c:columnHeader>
<c:detailCell height="30">
<textField isBlankWhenNull="true">
<reportElement mode="Opaque" x="0" y="0" width="100" height="30" uuid="c8f16b37-4f63-4043-abc6-d321125c247e"/>
<box>
<pen lineWidth="0.5"/>
</box>
<textElement verticalAlignment="Middle">
<paragraph leftIndent="3"/>
</textElement>
<textFieldExpression><![CDATA[$F{data2}]]></textFieldExpression>
</textField>
</c:detailCell>
</c:column>
<c:column width="20" uuid="4fff907e-9cb8-41d3-a264-b78ca5ed814a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<c:columnHeader height="30" rowSpan="1"/>
<c:detailCell height="30">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField>
<reportElement x="0" y="0" width="20" height="30" uuid="eb0dd902-0635-4a55-8f84-03834107f2bf"/>
<textFieldExpression><![CDATA[""]]></textFieldExpression>
</textField>
</c:detailCell>
</c:column>
</c:table>
</componentElement>
</band>
</detail>
</jasperReport>

Making text fields stretch in two separate subreports

I have a main subreport, that contains two similar subreports placed next to each other.
These two similar subreports both contain a text field in the detail band. Detail band is set to stretch.
My problem is when one of the text fields contain a long text, and the other is not,there will be a "gap" on side with the short text. The text field with the short text should stretch also.
Is there a way to achive this while maintaining two separate subreports? Or do I have create one subreport from the two, putting both text fields into one subreport?
Here's a simplifeid version of the main subreport, and the two subreport containing the text fields.
Main report:
<?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="Invoice" pageWidth="595" pageHeight="255" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="InvoiceBundle" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
<property name="ireport.zoom" value="1.5000000000000007"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="develop trunk"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<parameter name="ID" class="java.lang.Long">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
<parameter name="DATEFORMAT" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT 1 -- This is a must, because subreports in Detail Band will only show data if the query has result. TODO: Move this supreport into Header Band.]]>
</queryString>
<detail>
<band height="240" splitType="Stretch">
<frame>
<reportElement style="table" positionType="Float" x="0" y="140" width="555" height="80" uuid="ee798e27-e04b-46e1-ae6b-b85f881d6878"/>
<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>
<subreport isUsingCache="false">
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="300" height="80" uuid="2b946dfa-c599-4ea2-873b-d68073885475"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="REPORT_RESOURCE_BUNDLE">
<subreportParameterExpression><![CDATA[$P{REPORT_RESOURCE_BUNDLE}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "Left.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="300" y="0" width="255" height="80" uuid="aa26fd8b-b945-4d61-b3c6-2019f1e2c779"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="REPORT_RESOURCE_BUNDLE">
<subreportParameterExpression><![CDATA[$P{REPORT_RESOURCE_BUNDLE}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "Right.jasper"]]></subreportExpression>
</subreport>
</frame>
</band>
</detail>
</jasperReport>
Subreport on the left side, called Left.jasper:
<?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="Invoice" pageWidth="300" pageHeight="255" columnWidth="300" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="InvoiceBundle" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
<property name="ireport.zoom" value="1.5000000000000007"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="develop trunk"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="DATEFORMAT" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT 'this is a short text' AS short_text]]>
</queryString>
<field name="short_text" class="java.lang.String"/>
<detail>
<band height="80" splitType="Stretch">
<frame>
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="300" height="80" uuid="7688bc26-63fe-4013-b7dc-514f2f078be1"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="5" y="20" width="245" height="15" isPrintWhenDetailOverflows="true" uuid="c71b1e9d-f637-4511-b304-ba5a9603331e"/>
<textElement>
<font fontName="DejaVu Sans" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{short_text}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
</jasperReport>
Subreport on the right side, called Right.jasper:
<?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="Invoice" pageWidth="255" pageHeight="255" columnWidth="255" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="InvoiceBundle" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
<property name="ireport.zoom" value="1.5000000000000007"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="develop trunk"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select 'This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
' AS long_text]]>
</queryString>
<field name="long_text" class="java.lang.String"/>
<detail>
<band height="80" splitType="Stretch">
<frame>
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="255" height="80" uuid="9402fe9b-072f-4d99-9686-eaf896fa5281"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="5" y="20" width="250" height="15" isPrintWhenDetailOverflows="true" uuid="cf207ce1-909e-4e80-802b-7b8dcb22f05b"/>
<textElement>
<font fontName="DejaVu Sans" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{long_text}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
</jasperReport>

How to create a table with both static and dynamic values from parameters?

I want to create a table with static and dynamic values like the following picture:
As you can see, the red values are dynamic (values in parameters) while the rest of the table is static.
The problem is that I cannot add more than one detail row to the table.
Even if I use normal Text Field and Static Text elements instead of a Table I wouldn't be able to stretch the values (in case a value needs more than a single line) without overlapping.
How can I achieve this?
To use the jr:table component you need to have a datasource, normally you should get the data from some backend code, passing it to the report for example as a List in a parameter. Hence instead of passing the single parameters, you pass a datasource with both name and values.
However, for fun? we can create a datasource also within the jrxml code for example in your case I would use a ListOfArrayDataSource(java.util.List<java.lang.Object[]> records, java.lang.String[] columnNames)
The code to create the first two entries would be something this.
new net.sf.jasperreports.engine.data.ListOfArrayDataSource(
Arrays.asList(
new String[]{"Name", $P{name}},
new String[]{"Date of Birth", $P{dateOfBirth}}
),
new String[]{"c1", "c2"}
)
Full jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_15" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="342c93fd-9f0b-49db-a6e8-dbc252bbeca4">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<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="Dataset" uuid="604ce812-0b69-47fa-862f-c6b4356c6b62">
<queryString>
<![CDATA[]]>
</queryString>
<field name="c1" class="java.lang.String"/>
<field name="c2" class="java.lang.String"/>
</subDataset>
<parameter name="name" class="java.lang.String">
<defaultValueExpression><![CDATA["Nasser Ali"]]></defaultValueExpression>
</parameter>
<parameter name="dateOfBirth" class="java.lang.String">
<defaultValueExpression><![CDATA["1985-10-07"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="61" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="1" width="400" height="30" forecolor="#FFFFFF" backcolor="#000000" uuid="56949b5f-9b21-4f88-9660-ddccce0e7cad"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Personal information]]></text>
</staticText>
<componentElement>
<reportElement x="0" y="31" width="400" height="30" uuid="7a9309f0-4b5f-4c01-9b0a-611807b01f96">
<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"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</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="Dataset" uuid="f682c987-479a-40f9-8b97-bf07577e67fa">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.ListOfArrayDataSource(Arrays.asList(new String[]{"Name", $P{name}}, new String[]{"Date of Birth", $P{dateOfBirth}}),new String[]{"c1", "c2"})]]></dataSourceExpression>
</datasetRun>
<jr:column width="200" uuid="c087b83b-e6f9-4366-b655-eb7c14e35745">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="200" height="30" uuid="dce0c9d6-ec99-4cbb-b981-73d3dff1b67b"/>
<box leftPadding="5"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{c1}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="200" uuid="dad64648-00cb-46ff-9f74-216170605bf6">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:detailCell style="Table_TD" height="30">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField>
<reportElement x="0" y="0" width="200" height="30" forecolor="#FF0400" uuid="05d673a9-93d4-4b3e-a4eb-6fd5fd171b30"/>
<box leftPadding="5"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{c2}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</title>
</jasperReport>
Output:

Stretching field below another stretching field in the same group footer

Background
I have a report where the completed analyses are supposed to show below the outstanding work. I had the completed analyses set to float
If there is a lot of completed work, the field seems to stretch but does not print the information
I changed this completed analyses field to be fixed relative to top, and now it prints all of the information but overlaps if the Outstanding field expands
Thanks in advance for anybody who can help.
SQL
create table analyses (ID int not null IDENTITY PRIMARY KEY, info1 varchar(max), info2 varchar(max))
insert into analyses values ('short string', 'short string')
insert into analyses values ('Extremely long string which is so long that I don''t know how I can carry on thinking of things to write so I will just keep writing things like this until I get bored and eventually it will be long enough I think, well probably, not entirely sure','Extremely long string which is so long that I don''t know how I can carry on thinking of things to write so I will just keep writing things like this until I get bored and eventually it will be long enough I think, well probably, not entirely sure')
insert into analyses values ('another short string', 'another short string')
JRXML
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.3.final using JasperReports Library version 5.0.1 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_3" pageWidth="400" pageHeight="842" columnWidth="360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7f2b0070-ae21-43b8-aed2-2d97e01f5788">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<queryString>
<![CDATA[select * from analyses]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="Info1" class="java.lang.String"/>
<field name="Info2" class="java.lang.String"/>
<group name="Group1">
<groupExpression><![CDATA[$F{ID}]]></groupExpression>
<groupHeader>
<band height="24">
<staticText>
<reportElement x="188" y="0" width="62" height="24" uuid="c63aa7bc-0916-4bc4-b00a-2b2f7e0ecdc1">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<text><![CDATA[Info 1 +]]></text>
</staticText>
<staticText>
<reportElement x="251" y="0" width="68" height="24" forecolor="#EB3431" uuid="4915813a-f96b-4bd4-a278-5d51378419f5">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<text><![CDATA[Info 2]]></text>
</staticText>
<staticText>
<reportElement x="0" y="0" width="188" height="24" uuid="94aa55be-e050-4488-933d-d29497fe1adb">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<text><![CDATA[ID]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="24">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField>
<reportElement x="0" y="0" width="185" height="12" uuid="5b4f1d89-0191-4607-bca5-715d3828bbaa">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="185" y="0" width="135" height="12" uuid="ac96f759-7c22-4877-afb1-a7529d61a067">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Info1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="185" y="12" width="135" height="12" forecolor="#EB221E" uuid="44747f9d-582d-4b46-a729-104a0f5c7eaa">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Info2}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
</jasperReport>
For the 'Completed' textfield:
choose position type = 'Float'
choose stretch type = 'No Stretch'
make sure the 'Stretch with Overflow' option is checked (true)

Shift the complete content to next page if it is not getting adjusted in previous page

I have a scenario where I have to shift the complete content to next page if it is not getting adjusted to previous page. Currently the content getting broken up between pages. I tried to put the contents inside the frame element but didn't work.
Screenshot:
And Here is the jrxml file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.0.final using JasperReports Library version 6.3.0 -->
<!-- 2017-08-10T12:25:01 -->
<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="note11-pledgedassets" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="0" uuid="eff89e48-1135-41dd-b056-b42855f2ba3d">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<style name="style2">
<conditionalStyle>
<conditionExpression><![CDATA[$F{label}.equals("Summa ställda säkerheter :")]]></conditionExpression>
<style fontName="SegoeUI" isItalic="true"/>
</conditionalStyle>
</style>
<queryString>
<![CDATA[]]>
</queryString>
<field name="label" class="java.lang.String"/>
<field name="amount" class="java.lang.String"/>
<field name="count" class="java.lang.Integer"/>
<field name="number" class="java.lang.Integer"/>
<field name="financialYearEndDate" class="java.lang.String"/>
<field name="text" class="java.lang.String"/>
<detail>
<band height="90" splitType="Prevent">
<frame>
<reportElement positionType="Float" x="21" y="1" width="530" height="89" isRemoveLineWhenBlank="true" uuid="c171bfff-1a99-40f3-a010-9429cae01a9c">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="3.0" lineStyle="Solid"/>
<leftPen lineWidth="3.0" lineStyle="Solid"/>
<bottomPen lineWidth="3.0" lineStyle="Solid"/>
<rightPen lineWidth="3.0" lineStyle="Solid"/>
</box>
<textField isBlankWhenNull="true">
<reportElement style="style2" positionType="Float" x="1" y="28" width="364" height="15" isRemoveLineWhenBlank="true" uuid="693a615c-58a8-4b74-859f-31da16548c0f">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<printWhenExpression><![CDATA[$F{amount}!=null && !$F{amount}.equals("0")]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Bottom">
<font fontName="SegoeUI" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="style2" positionType="Float" x="384" y="28" width="100" height="15" isRemoveLineWhenBlank="true" uuid="e1094881-70b8-47af-b7d4-a52b16285a12">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<printWhenExpression><![CDATA[$F{amount}!=null && !$F{amount}.equals("0")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Bottom">
<font fontName="SegoeUI" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{amount}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="1" y="15" width="100" height="13" isRemoveLineWhenBlank="true" uuid="82c2a4cc-07ca-4252-99c9-a497c7664c23">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<printWhenExpression><![CDATA[$F{count}==1]]></printWhenExpression>
</reportElement>
<text><![CDATA[]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="1" y="43" width="270" height="31" isRemoveLineWhenBlank="true" uuid="c0fac058-23f1-47e2-a57b-f8d8111437d6">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<printWhenExpression><![CDATA[$F{text}!=null]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Bottom">
<font fontName="SegoeUI" size="9" isItalic="true"/>
</textElement>
<text><![CDATA[Säkerheter till förmål för styrelse, vd mfl]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="1" y="74" width="474" height="15" isRemoveLineWhenBlank="true" uuid="385ae7d5-4c0e-437e-b04c-64f925c275df">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<printWhenExpression><![CDATA[$F{text}!=null]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Bottom">
<font fontName="SegoeUI" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{text}]]></textFieldExpression>
</textField>
<frame>
<reportElement mode="Opaque" x="0" y="1" width="490" height="14" isRemoveLineWhenBlank="true" backcolor="#CCCCCC" uuid="2dd91d48-f783-422b-9a4c-956f93f62590">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<printWhenExpression><![CDATA[$F{count}==1]]></printWhenExpression>
</reportElement>
</frame>
<staticText>
<reportElement mode="Opaque" x="2" y="1" width="40" height="14" isRemoveLineWhenBlank="true" backcolor="#CCCCCC" uuid="d25eb93c-cf83-449b-8a64-b08b3662dfb7">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<printWhenExpression><![CDATA[$F{count}==1]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="SegoeUI-SemiBold" size="9"/>
</textElement>
<text><![CDATA[Not]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement mode="Opaque" x="384" y="1" width="100" height="14" isRemoveLineWhenBlank="true" backcolor="#CCCCCC" uuid="442d41c6-ab53-4af4-a17c-e48f27a60bba">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<printWhenExpression><![CDATA[$F{count}==1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SegoeUI-SemiBold" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{financialYearEndDate}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement mode="Opaque" x="29" y="1" width="40" height="14" isRemoveLineWhenBlank="true" backcolor="#CCCCCC" uuid="1b39f3a4-56a6-4b41-af03-01dbed404c68">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<printWhenExpression><![CDATA[$F{count}==1]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="SegoeUI-SemiBold" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{number}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="69" y="1" width="296" height="14" isRemoveLineWhenBlank="true" backcolor="#CCCCCC" uuid="8c1f2b48-7417-494b-9143-08145e05939f">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<printWhenExpression><![CDATA[$F{count}==1]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="SegoeUI-SemiBold" size="9"/>
</textElement>
<text><![CDATA[Ställda säkerheter]]></text>
</staticText>
</frame>
</band>
</detail>
</jasperReport>
Put that particual content in separate details section and set the split type as prevent for that detail section.