JasperReport image dynamic vertical stretching depending on page size - can it be done? - jasper-reports

I have a jasper report that looks like a certificate.
I have a background image that serves as the attractive bordering or frame of the whole page.
The problem is, if for example, the name in text field is much bigger than the element container, it creates extra white space in the bottom.
The background image / frame is not stretching to stretch the the whole edges of the page.
The same is true when the text fields are shorter. But in this case, the page is shortened to the point that you almost cannot see the bottom portion of the frame.
I want the image to dynamically stretch depending on the final size of the page at runtime.
Here is the look of my design:
This is what happens when it is compiled, as you can see there are extra white spaces at the bottom:
This is the current setting of my image..
Position Type: Float
Stretch Type: ContainerBottom
The jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="paiwi-certificate-pdf" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="792" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="28bcb6f8-04d6-48df-ab31-e1bedc2f2434">
<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="farmContactListSubreportDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<parameter name="farmName" class="java.lang.String"/>
<parameter name="farmLogo" class="java.lang.String"/>
<parameter name="farmAddress" class="java.lang.String"/>
<parameter name="farmBusinessAddress" class="java.lang.String"/>
<parameter name="temporaryPartnersName" class="java.lang.String"/>
<parameter name="partnerName" class="java.lang.String"/>
<parameter name="partnerContactNumber" class="java.lang.String"/>
<parameter name="partnerEmail" class="java.lang.String"/>
<parameter name="packageName" class="java.lang.String"/>
<parameter name="batchName" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<detail>
<band height="612" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement positionType="Float" x="146" y="80" width="224" height="40" forecolor="#332411" uuid="cb95bd0b-631e-4363-80f5-22d0b0e481fe">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false"/>
</textElement>
<text><![CDATA[CERTIFICATE]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="372" width="446" height="28" uuid="6281f2a7-4eca-4319-b298-22184617a6d3">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="24" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="400" width="446" height="17" uuid="f19dc14b-3ada-460b-8633-85fd5a896d45">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmAddress}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="417" width="446" height="17" uuid="dec9944a-2758-4202-acfe-6f97df346b8f">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmBusinessAddress}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="164" y="180" width="473" height="40" forecolor="#332411" uuid="b2a59bb8-1557-498f-b17a-3f0e561bb11b">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="37" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{partnerName} != null && !$P{partnerName}.equalsIgnoreCase("") ? $P{partnerName} : $P{temporaryPartnersName}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement positionType="Float" x="569" y="338" width="164" height="160" uuid="717d6475-3d42-4e54-a69a-7271bc862e33"/>
<imageExpression><![CDATA[$P{farmLogo}]]></imageExpression>
</image>
<staticText>
<reportElement positionType="Float" x="416" y="81" width="228" height="40" forecolor="#332411" uuid="f2a78f2d-ed74-45b9-89e8-3365c4afe801">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false"/>
</textElement>
<text><![CDATA[COMPLETION]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="378" y="80" width="33" height="40" forecolor="#332411" uuid="e1c7ac87-81ce-4e8d-b718-2aee4f139003"/>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false" isItalic="true"/>
</textElement>
<text><![CDATA[of]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="311" y="148" width="179" height="15" forecolor="#6E6E6E" uuid="3d5afae8-14e2-4a3b-8471-db8388e2309f">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[THIS ACKNOWLEDGES THAT]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="290" y="249" width="232" height="15" forecolor="#6E6E6E" uuid="4c301efe-c460-478e-873a-d16430000b18">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[HAS SUCCESSFULLY COMPLETED THE]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="50" y="357" width="232" height="15" forecolor="#6E6E6E" uuid="1060f753-1051-4925-9efe-c2ee62146b25">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[ACKNOWLEDGED BY:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="275" y="279" width="263" height="17" uuid="3ab3ec94-b64f-42df-b475-7996bcac1abb">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{packageName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="359" y="296" width="43" height="16" forecolor="#000000" uuid="c6e10785-2750-4247-af0c-6cbafa3aa294"/>
<textElement markup="none">
<font fontName="Georgia" size="14" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[Batch:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="402" y="296" width="48" height="16" forecolor="#000000" uuid="dff76163-3fd3-4bf6-94fd-de4612485e29">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{batchName}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement positionType="Float" x="140" y="279" width="126" height="30" uuid="b0c2acd4-1a0c-4fe6-9a94-be43fe67d704"/>
<imageExpression><![CDATA["https://i.imgur.com/Ug4T4oX.png"]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement positionType="Float" x="550" y="279" width="126" height="30" uuid="9d2cddda-e519-42e2-b74b-554f4c102ef2"/>
<imageExpression><![CDATA["https://i.imgur.com/paQHNxJ.png"]]></imageExpression>
</image>
<image scaleImage="RetainShape" vAlign="Bottom" onErrorType="Blank" evaluationTime="Page">
<reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="0" width="782" height="612" isPrintInFirstWholeBand="true" uuid="2dadd1da-0694-4e21-86de-fae790844411">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA["https://i.imgur.com/y8uffu8.png"]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>

I think your only problem is that you do not have the correct scaleImage property set, hence the element is actually resizing but since you have scaleImage="RetainShape" the image will not fill the new element dimension but instead maintain orignal image proportions
From Jasper Reports Ultimate guide:
Clipping the image: If the actual image is larger than the image element size, it will be cut off so that it keeps its original
resolution, and only the region that fits the specified size will be
displayed (scaleImage="Clip").
Forcing the image size: If the dimensions of the actual image do not fit those specified for the image element that displays it, the image
is forced to obey them and stretch itself so that it fits in the
designated output area. It will be deformed if necessary
(scaleImage="FillFrame").
Keeping the image proportions: If the actual image does not fit into the image element, it can be adapted to those dimensions while
keeping its original undeformed proportions
(scaleImage="RetainShape").
Stretching the image keeping the width: The image can be stretched vertically to match the actual image height, while preserving the
declared width of the image element (scaleImage="RealHeight").
Stretching the image adjusting the width: The image can be stretched vertically to match the actual image height, while adjusting
the width of the image element to match the actual image width
(scaleImage="RealSize").
So you need:
scaleImage="FillFrame"
something like this
<image scaleImage="FillFrame" vAlign="Bottom" onErrorType="Blank">
<reportElement stretchType="ContainerHeight" x="10" y="0" width="782" height="612" uuid="2dadd1da-0694-4e21-86de-fae790844411">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA["https://i.imgur.com/y8uffu8.png"]]></imageExpression>
</image>

Related

How shrink a frame when the bottom frames inside are blank.?

So im trying shrink the right frame when the last two inside frames containing the
text fields(red boxes) are blank. The left and right main frames are also inside a frame. But even if only have 4 rows i always get the unused space in the report.
<detail>
<band height="11" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<printWhenExpression><![CDATA[$V{REPORT_COUNT}>1]]></printWhenExpression>
</band>
<band height="71" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="554" height="71" isRemoveLineWhenBlank="true" uuid="603f6666-1471-4d16-b0aa-bde352f18b8e">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<frame>
<reportElement style="Default" stretchType="RelativeToTallestObject" x="0" y="0" width="301" height="50" isRemoveLineWhenBlank="true" uuid="a12bdb49-abd3-4ecf-83db-033e5846174d"/>
<frame>
<reportElement positionType="Float" x="0" y="20" width="300" height="10" isRemoveLineWhenBlank="true" uuid="ec17f3b3-e6e1-4f57-89e1-3499e4aa63cb">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[!(EXACT(continitions]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="80" height="10" uuid="96082d63-b65e-4461-951d-6f6532ca9fe0">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["Morada"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToTallestObject" x="58" y="0" width="218" height="10" isRemoveLineWhenBlank="true" uuid="227f2a1f-3fc6-4fbf-a680-6d4ec4bbf86b"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[(condditions]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="30" width="300" height="10" isRemoveLineWhenBlank="true" uuid="115c7def-a074-4164-8738-649cecaa095a">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[conditions]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="80" height="10" uuid="d46cb243-e8e7-4775-9abb-c8600e44f884">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["field_label"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="" x="58" y="0" width="218" height="10" isRemoveLineWhenBlank="true" uuid="c9f0f6dc-9fc3-49bd-ac4c-7de41ac07633"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[conditions]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="10" width="300" height="10" isRemoveLineWhenBlank="true" uuid="016e4775-e417-4f5c-a4de-b0be970e9d3a">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="80" height="10" uuid="e4e78c67-a0c0-4d01-9942-3429ce402bc5">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$(field)]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="58" y="0" width="218" height="10" isRemoveLineWhenBlank="true" uuid="6b3ac9a8-28a5-413e-9348-e9625f94c235">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="0" y="0" width="300" height="10" isRemoveLineWhenBlank="true" uuid="7f7b2531-9450-4a9f-b311-625df5ccae4f">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="80" height="10" isRemoveLineWhenBlank="true" uuid="c5a3d310-c74f-4546-97b0-18aa4de9a45a">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["field"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="58" y="0" width="218" height="10" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="649b1963-912c-4902-8052-1320e32e67ab">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_value}]]></textFieldExpression>
</textField>
</frame>
</frame>
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="301" y="0" width="244" height="70" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="c1a1530c-2fca-43d8-a238-f48f3290da29">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<frame>
<reportElement positionType="Float" x="0" y="40" width="244" height="10" isRemoveLineWhenBlank="true" uuid="a96e6e9f-e02f-4e9b-a900-2e55a33df0f3">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[!($F{condition)))]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="edb4759b-cf68-4367-8bc4-7e07364ae3c5">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["field_label"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" isPrintWhenDetailOverflows="true" uuid="48766f62-03de-407a-a771-6e82e5a4c7ff">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_value}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="10" width="244" height="10" isRemoveLineWhenBlank="true" uuid="acbe8ba0-af8d-4e1a-93a8-7305a02839a6">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[!($F{condition)))]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" uuid="d14807d2-aa00-421f-9dab-7cce0adf758a">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" uuid="63e62a4d-9dca-4dca-85f5-515a4ee18d0b">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{locationscope_value}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="0" width="244" height="10" isRemoveLineWhenBlank="true" uuid="cc62c22d-cc19-4461-ba53-74f4ba733322">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[!($F{condition})))]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" uuid="6ce16cc5-2a18-4b3d-a7f7-17979a0a111b">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" uuid="cc7b895b-2e4f-4118-830f-1bde2e181be6">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{scope_value}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="30" width="244" height="10" isRemoveLineWhenBlank="true" uuid="4c9ae6a0-6534-4952-be6c-7a18d8351a3c">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[!($F{condition})))]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" uuid="1c8aedb1-020b-4d7f-aea2-93b0557b2c23">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["label"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" uuid="c7ae3de9-2f2d-4178-85b2-bf2091766558">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_value}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="20" width="244" height="10" isRemoveLineWhenBlank="true" uuid="8f058c9f-27d5-4f0f-8eac-32a58fa7ad06">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<printWhenExpression><![CDATA[!($F{condition})]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" uuid="ba3f46e3-c823-4815-a74d-7a4caa77828f">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" uuid="75cce569-0fc5-425b-a9fc-9a42516a4305">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_value}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="50" width="244" height="10" isRemoveLineWhenBlank="true" uuid="18fad1eb-f42f-4876-be03-40aac2765875">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<printWhenExpression><![CDATA[!($F{condition}]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" uuid="2e21f092-a95f-42b1-897e-50af56985554">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_label}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" uuid="a9fe6852-4253-4fb9-a089-d007459655dd">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_value}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="60" width="244" height="10" isRemoveLineWhenBlank="true" uuid="c102458f-d273-4611-a851-ed8e83adfead">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<printWhenExpression><![CDATA[!($F{condntion})]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10" uuid="80dcd916-f4c8-434d-a833-e864f64ddae5">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA["field_label"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="100" y="0" width="144" height="10" uuid="5676615c-3ae5-41c6-8cf1-dbdef5cc3a99">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{field_value}]]></textFieldExpression>
</textField>
</frame>
</frame>
</frame>
</band>
</detail>
In jasper reports you can not shrink elements, instead you need to stretch them when needed.
In your case this means that your frames in report needs to be at the minimum size you need, then if there is more content in them you stretch it.
For example, your first frame
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="554" height="71" isRemoveLineWhenBlank="true" uuid="603f6666-1471-4d16-b0aa-bde352f18b8e">
......
it will always have a minimum height of 71, if it it needs to be smaller (when some components are not displayed) you need to reduce this value to for example 10.
To explain this behavior, I will attach a small example, with a frame (that has a border) that contains 2 static text fields and the second one will display based on a parameter.
<?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_3" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="53801704-697f-43ac-aed6-9e952be4ab7f">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="ShowText2" class="java.lang.Boolean">
<defaultValueExpression><![CDATA[true]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="96" splitType="Stretch">
<frame>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="545" height="30" uuid="6ca5ba0c-b9c0-4ae9-be7f-e7a372593e94"/>
<box>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="7291cb69-0d98-4ce2-8031-60b5c6df4ebb"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Static text 1]]></text>
</staticText>
<staticText>
<reportElement x="0" y="30" width="100" height="30" isRemoveLineWhenBlank="true" uuid="7df247c0-2c72-4413-83f5-3d4d3aec258c">
<printWhenExpression><![CDATA[$P{ShowText2}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Static text 2]]></text>
</staticText>
</frame>
</band>
</title>
</jasperReport>
Output
Not displaying second text field
Displaying second text field
The key concept is that the frame has height="30" which is the not stretched value (minimum value) and instead it gets stretched to height="60" if the second text field is displayed.
Note: I'm using stretchType="ElementGroupHeight" since stretchType="RelativeToTallestObject" is deprecated.

How on frame keep same behavior when printWhenExpression is false as if it does not exists?

So I have a detail band with two frames, the first frame has several elements including a subreport, the second frame only has a textfield.
The issue I'm having is, if i remove the second frame from the band all the content remains in the same page. If i add the second frame and use the printonly expression to not show it, it changes the entire content to the next page.
Is there a way to force that, if the second frame is empty to maintain the behavior as if didn't exist at all?
<band height="160" splitType="Prevent">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<frame>
<reportElement isPrintRepeatedValues="false" x="0" y="1" width="556" height="116" isRemoveLineWhenBlank="true" uuid="3aca49ee-4b55-452c-a8c6-5cc252c4175c">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreport>
<reportElement positionType="Float" x="2" y="65" width="160" height="51" uuid="438d3f08-7b8a-4b61-b17f-19993aa5abe4">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="cm"/>
</reportElement>
<subreportParameter name="DOC_ID">
<subreportParameterExpression><![CDATA[$P{DOC_ID}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="IS_RUNNING_LOCAL">
<subreportParameterExpression><![CDATA[$P{IS_RUNNING_LOCAL}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{IS_RUNNING_LOCAL} ? "/Reports/Common/xxxxxxxxxxxxxxSub.jasper" : "repo:/Reports/Common/xxxxxxxxxxxxxxSub"]]></subreportExpression>
</subreport>
<textField isStretchWithOverflow="true">
<reportElement style="Default" positionType="Float" mode="Transparent" x="1" y="1" width="552" height="30" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="837c85bf-7a2a-4eb5-919d-bd16d4bc64f2">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="cm"/>
<property name="local_mesure_unitheight" value="pixel"/>
</reportElement>
<box padding="0" topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/>
<textElement textAlignment="Justified" verticalAlignment="Top" rotation="None" markup="html">
<font fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" tabStopWidth="40"/>
</textElement>
<textFieldExpression><![CDATA["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Default" positionType="Float" mode="Transparent" x="2" y="43" width="511" height="17" forecolor="#000000" backcolor="#FFFFFF" uuid="3e1c3952-6578-4d5f-85a3-d706fc5a5fbb">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitx" value="cm"/>
<property name="com.jaspersoft.studio.unit.x" value="cm"/>
<property name="local_mesure_unitheight" value="pixel"/>
</reportElement>
<box padding="0" topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/>
<textElement textAlignment="Justified" verticalAlignment="Top" rotation="None" markup="html">
<font fontName="Arial" size="9" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single" lineSpacingSize="1.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" tabStopWidth="40"/>
</textElement>
<textFieldExpression><![CDATA["testetestestestestestes"]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="1" y="120" width="555" height="40" isRemoveLineWhenBlank="true" uuid="c3bf96ce-dd19-41f1-bf13-fe1dd46d8d4e">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$P{COD_DOC}.equals("xx_xxx_xxx")]]></printWhenExpression>
</reportElement>
<textField isBlankWhenNull="true">
<reportElement positionType="Float" isPrintRepeatedValues="false" mode="Transparent" x="1" y="0" width="551" height="39" isRemoveLineWhenBlank="true" uuid="c1ab35b8-31a6-41e9-a260-71bbcab8692e">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[$P{COD_DOC}.equals("xx_xxx_xxx")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Justified">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA["PS: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]]></textFieldExpression>
</textField>
</frame>
</band>
Is there a way to force that, if the second frame is empty to maintain the behavior as if didn't exist at all?
The solution to this is to use multiple detail bands and set the printWhenExpression to the detail band
<?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="TestParams" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f85bc6aa-5060-4485-bd99-bd5de1734ef1">
<queryString>
<![CDATA[]]>
</queryString>
<detail>
<band height="116">
<break>
<reportElement x="0" y="5" width="100" height="1" uuid="fb9c89cd-1b6a-44f5-82a9-99e9996229e3">
<printWhenExpression><![CDATA[$P{COD_DOC}.equals("xx_xxx_xxx")]]></printWhenExpression>
</reportElement>
</break>
<frame>
<reportElement x="0" y="10" width="200" height="116" uuid="e6890adf-6ff1-49f6-9c47-ba6f171a2c60"/>
</frame>
</band>
<band height="40">
<printWhenExpression><![CDATA[$P{COD_DOC}.equals("xx_xxx_xxx")]]></printWhenExpression>
<frame>
<reportElement x="0" y="0" width="200" height="40" uuid="d9f8ba4a-e435-49ff-9ff7-d23e55aecc52"/>
</frame>
</band>
</detail>
</jasperReport>
This way if second component is not showing/printed the whole band (height) will be removed and it will behave as only first band exists.

How to display each group of items on a new sheet in JasperReports?

I have a simple Spring-based web application for reporting about measurement tools. I'm using the following JRXML pattern (generated by TIBCO Jaspersoft Studio), let's say report_3.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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Default" isDefault="true" pdfFontName="ARIAL.TTF" pdfEncoding="Cp1251"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="polviz" class="java.lang.String"/>
<field name="polzex" class="java.lang.String"/>
<field name="polnaim" class="java.lang.String"/>
<field name="tip" class="java.lang.String"/>
<field name="klt" class="java.lang.Double"/>
<field name="pred" class="java.lang.String"/>
<field name="zavn" class="java.lang.String"/>
<field name="npasp" class="java.lang.Integer"/>
<field name="pp" class="java.lang.Integer"/>
<field name="n" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="84">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement x="410" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[УТВЕРЖДАЮ]]></text>
</staticText>
<staticText>
<reportElement x="410" y="14" width="100" height="20" />
<text><![CDATA[Главный метролог]]></text>
</staticText>
<line>
<reportElement x="410" y="39" width="120" height="1" />
</line>
<staticText>
<reportElement x="410" y="39" width="140" height="30" />
<textElement>
<font size="6"/>
</textElement>
<text><![CDATA[(подпись, расшифровка подписи, дата)]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="85" splitType="Stretch">
<staticText>
<reportElement positionType="FixRelativeToBottom" x="-2" y="0" width="559" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Общая ведомость средств измерений по цехам]]></text>
</staticText>
<line>
<reportElement x="0" y="83" width="554" height="1" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="0" y="66" width="554" height="16" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polviz}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="1" y="52" width="552" height="14" />
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isItalic="false"/>
</textElement>
<text><![CDATA[/ N - не проверено, R - ремонт, К - консервация /]]></text>
</staticText>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="1" y="30" width="552" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polzex}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="34" splitType="Stretch">
<staticText>
<reportElement x="1" y="1" width="110" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Наим. средства изм.]]></text>
</staticText>
<staticText>
<reportElement x="110" y="1" width="50" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Тип]]></text>
</staticText>
<staticText>
<reportElement x="160" y="1" width="68" height="30" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Предел изм.]]></text>
</staticText>
<staticText>
<reportElement x="280" y="1" width="78" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Зав. ном.]]></text>
</staticText>
<line>
<reportElement x="0" y="32" width="554" height="1" />
</line>
<line>
<reportElement x="0" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="109" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="159" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="228" y="-2" width="1" height="34" />
</line>
<line>
<reportElement x="359" y="-2" width="1" height="34" />
</line>
<staticText>
<reportElement x="360" y="1" width="74" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Ном. пасп.]]></text>
</staticText>
<line>
<reportElement x="434" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="436" y="0" width="54" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Периодич.]]></text>
</staticText>
<line>
<reportElement x="490" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="490" y="0" width="62" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Неп,Рем,Конс]]></text>
</staticText>
<line>
<reportElement x="554" y="-1" width="1" height="33" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="230" y="1" width="46" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Кл.т.]]></text>
</staticText>
<line>
<reportElement x="277" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
</band>
</columnHeader>
<detail>
<band height="33">
<line>
<reportElement x="1" y="19" width="553" height="1" forecolor="#E5E5E5" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement x="2" y="1" width="108" height="18" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{polnaim}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="1" width="50" height="18" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{tip}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="161" y="1" width="68" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pred}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="1" width="48" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{klt}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="1" width="82" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{zavn}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="360" y="1" width="76" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{npasp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="436" y="1" width="56" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="492" y="1" width="62" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{n}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="21"/>
</lastPageFooter>
</jasperReport>
Part of JasperReportsController controller:
...
#Controller
#RequestMapping("/jasper-reports/")
public class JasperReportsController {
#Autowired(required = true)
private MetrologServices metrologServices;
#Autowired
private ApplicationContext appContext;
#RequestMapping(method = RequestMethod.GET, value = "report_3")
public ModelAndView generateThirdPdfReport(ModelAndView modelAndView) {
JasperReportsPdfView jrPdfView = new JasperReportsPdfView();
List<ReportDTO> records = findInventoryReportData();
Map<String, Object> map = new HashMap<String, Object>();
map.put("records", records);
jrPdfView.setUrl("classpath:report_3.jrxml");
jrPdfView.setReportDataKey("records");
jrPdfView.setApplicationContext(appContext);
modelAndView = new ModelAndView(jrPdfView, map);
return modelAndView;
}
private List<ReportDTO> findInventoryReportData() {
List<ReportDTO> result = metrologServices.loadInventoryData();
return result;
}
...
}
Somewhere in the view I call the controller:
$("#btn-print").attr("href", "${home}/metrolog/jasper-reports/report_3");
As a result I get the following report:
I want to start the list of measurement tools for each department with a new page. For example, part of the measuring tools belongs to department 1, another part belongs to department 2, etc.
I'd advise the following documentation: Chapter 14. View technologies, see section "14.7.4. Working with Sub-Reports":
JasperReports provides support for embedded sub-reports within your
master report files. There are a wide variety of mechanisms for
including sub-reports in your report files. The easiest way is to hard
code the report path and the SQL query for the sub report into your
design files. The drawback of this approach is obvious - the values
are hard-coded into your report files reducing reusability and making
it harder to modify and update report designs. To overcome this you
can configure sub-reports declaratively and you can include additional
data for these sub-reports directly from your controllers.
To control which sub-report files are included in a master report
using Spring, your report file must be configured to accept
sub-reports from an external source. To do this you declare a
parameter in your report file like so:
<parameter name="ProductsSubReport" class="net.sf.jasperreports.engine.JasperReport"/>
Then, you define your sub-report to use this sub-report parameter:
<subreport>
<reportElement isPrintRepeatedValues="false" x="5" y="25" width="325"
height="20" isRemoveLineWhenBlank="true" backcolor="#ffcc99"/>
<subreportParameter name="City">
<subreportParameterExpression><![CDATA[$F{city}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[$P{SubReportData}]]></dataSourceExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
<![CDATA[$P{ProductsSubReport}]]></subreportExpression>
</subreport>
This defines a master report file that expects the sub-report to be
passed in as an instance of
net.sf.jasperreports.engine.JasperReports under the parameter
ProductsSubReport. When configuring your Jasper view class, you can
instruct Spring to load a report file and pass into the JasperReports
engine as a sub-report using the subReportUrls property:
<property name="subReportUrls">
<map>
<entry key="ProductsSubReport" value="/WEB-INF/reports/subReportChild.jrxml"/>
</map>
</property>
Here, the key of the Map corresponds to the name of the sub-report
parameter in th report design file, and the entry is the URL of the
report file. Spring will load this report file, compiling it if
necessary, and will pass into the JasperReports engine under the given
key.
Hence, the master report file can be represented as follows:
report_3.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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<style name="Default" isDefault="true" pdfFontName="ARIAL.TTF" pdfEncoding="Cp1251"/>
<parameter name="Kpp9SubReport" class="net.sf.jasperreports.engine.JasperReport"/>
<parameter name="Kpp9SubReportData" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<parameter name="..." class="net.sf.jasperreports.engine.JasperReport"/>
<parameter name="..." class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
...
etc
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="84">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement x="410" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[УТВЕРЖДАЮ]]></text>
</staticText>
<staticText>
<reportElement x="410" y="14" width="100" height="20" />
<text><![CDATA[Главный метролог]]></text>
</staticText>
<line>
<reportElement x="410" y="39" width="120" height="1" />
</line>
<staticText>
<reportElement x="410" y="39" width="140" height="30" />
<textElement>
<font size="6"/>
</textElement>
<text><![CDATA[(подпись, расшифровка подписи, дата)]]></text>
</staticText>
</band>
</title>
<detail>
<band height="500">
<subreport>
<reportElement isPrintRepeatedValues="false" x="-10" y="0" width="325" height="1" isRemoveLineWhenBlank="false" backcolor="#ffcc99"/>
<dataSourceExpression><![CDATA[$P{DepartmentKpp9SubReportData}]]></dataSourceExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
<![CDATA[$P{DepartmentKpp9SubReport}]]></subreportExpression>
</subreport>
<break type="Page">
<reportElement x="-10" y="1" width="325" height="10" key="element-1"/>
</break>
</band>
<band height="500">
<subreport>
<reportElement isPrintRepeatedValues="false" x="-10" y="2" width="325" height="1" isRemoveLineWhenBlank="false" backcolor="#ffcc99"/>
<dataSourceExpression><![CDATA[$P{Department8SubReportData}]]></dataSourceExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
<![CDATA[$P{Department8SubReport}]]></subreportExpression>
</subreport>
<break type="Page">
<reportElement x="-10" y="3" width="325" height="1" key="element-2"/>
</break>
</band>
<band height="500">
...
</band>
...
etc
</detail>
<lastPageFooter>
<band height="21"/>
</lastPageFooter>
</jasperReport>
The sub-report report_4.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" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<style name="Default" isDefault="true" pdfFontName="ARIAL.TTF" pdfEncoding="Cp1251"/>
<field name="polviz" class="java.lang.String"/>
<field name="polzex" class="java.lang.String"/>
<field name="polnaim" class="java.lang.String"/>
<field name="tip" class="java.lang.String"/>
<field name="klt" class="java.lang.Double"/>
<field name="pred" class="java.lang.String"/>
<field name="zavn" class="java.lang.String"/>
<field name="npasp" class="java.lang.Integer"/>
<field name="pp" class="java.lang.Integer"/>
<field name="n" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="85" splitType="Stretch">
<staticText>
<reportElement positionType="FixRelativeToBottom" x="-2" y="0" width="559" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Общая ведомость средств измерений по цехам]]></text>
</staticText>
<line>
<reportElement x="0" y="83" width="554" height="1" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="0" y="66" width="554" height="16" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polviz}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="1" y="52" width="552" height="14" />
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isItalic="false"/>
</textElement>
<text><![CDATA[/ N - не проверено, R - ремонт, К - консервация /]]></text>
</staticText>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="1" y="30" width="552" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polzex}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="34" splitType="Stretch">
<staticText>
<reportElement x="1" y="1" width="110" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Наим. средства изм.]]></text>
</staticText>
<staticText>
<reportElement x="110" y="1" width="50" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Тип]]></text>
</staticText>
<staticText>
<reportElement x="160" y="1" width="68" height="30" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Предел изм.]]></text>
</staticText>
<staticText>
<reportElement x="280" y="1" width="78" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Зав. ном.]]></text>
</staticText>
<line>
<reportElement x="0" y="32" width="554" height="1" />
</line>
<line>
<reportElement x="0" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="109" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="159" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="228" y="-2" width="1" height="34" />
</line>
<line>
<reportElement x="359" y="-2" width="1" height="34" />
</line>
<staticText>
<reportElement x="360" y="1" width="74" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Ном. пасп.]]></text>
</staticText>
<line>
<reportElement x="434" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="436" y="0" width="54" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Периодич.]]></text>
</staticText>
<line>
<reportElement x="490" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="490" y="0" width="62" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Неп,Рем,Конс]]></text>
</staticText>
<line>
<reportElement x="554" y="-1" width="1" height="33" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="230" y="1" width="46" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Кл.т.]]></text>
</staticText>
<line>
<reportElement x="277" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
</band>
</columnHeader>
<detail>
<band height="33">
<line>
<reportElement x="1" y="19" width="553" height="1" forecolor="#E5E5E5" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement x="2" y="1" width="108" height="18" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{polnaim}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="1" width="50" height="18" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{tip}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="161" y="1" width="68" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pred}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="1" width="48" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{klt}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="1" width="82" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{zavn}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="360" y="1" width="76" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{npasp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="436" y="1" width="56" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="492" y="1" width="62" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{n}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="21"/>
</lastPageFooter>
</jasperReport>
Part of JasperReportsController controller(we consider only the case of one department, the other sub-reports can be obtained similarly using the same templates report_3.jrxml and report_4.jrxml):
...
#Controller
#RequestMapping("/jasper-reports/")
public class JasperReportsController {
#Autowired(required = true)
private MetrologServices metrologServices;
#Autowired
private ApplicationContext appContext;
#RequestMapping(method = RequestMethod.GET, value="report_3")
public ModelAndView generateThirdPdfReport(ModelAndView modelAndView) {
JasperReportsPdfView jrPdfView = new JasperReportsPdfView();
List<ReportDTO> records = findInventoryReportData();
Map<String, Object> map = new HashMap<>();
map.put("records", records);
Properties subReports = new Properties();
subReports.put("Kpp9SubReport", "classpath:report_4.jrxml");
List<ReportDTO> kpp9SubReportRecords = new ArrayList<>();
records.forEach(record -> {
if(record.getPolzex().equalsIgnoreCase("КПП 9")) {
kpp9SubReportRecords.add(record);
}
});
JRDataSource kpp9SubReportDataSource =
new JRBeanCollectionDataSource(kpp9SubReportRecords);
parameterMap.put("Kpp9SubReportData", kpp9SubReportDataSource);
jrPdfView.setSubReportUrls(subReports);
jrPdfView.setSubReportDataKeys("Kpp9SubReportData");
jrPdfView.setUrl("classpath:report_3.jrxml");
jrPdfView.setReportDataKey("records");
jrPdfView.setApplicationContext(appContext);
modelAndView = new ModelAndView(jrPdfView, map);
return modelAndView;
}
private List<ReportDTO> findInventoryReportData() {
List<ReportDTO> result = metrologServices.loadInventoryData();
return result;
}
...
}
As a result, we getting such a report, as required(in the department there are only five measuring instruments):

Jasper SubReport doesnt' show in Master

I asked a similar question a year ago and didn't discover a resolution. The subreport I am working on now is in the detail band of the master, although I did try it in others just in case.
<detail>
<band height="34" splitType="Stretch">
<subreport>
<reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Transparent" x="0" y="0" width="555" height="34" uuid="6318f4b9-c420-4294-a63f-1a83d338f755">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreportParameter name="item_id">
<subreportParameterExpression><![CDATA[$F{item_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["report.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
I checked the path to the subreport is correct. In the subreport the parameter_name is exactly the same. The .jasper file is compiled successfully.
The master report has a call to a stored procedure, and I am using one of the fields it is returning as the subreport parameter. I called it 'item_id' here. I used the wizard to map that to the subreport parameter with the same name. The idea is that the subreport should return additional information about each of the item_ids returned by the SP in the master report.
When I run the subreport on it's own it returns data for a particular item_id. I created a variable in the master to track how many rows the SP itself returns and when I run the master it shows the correct number of rows exist but no data displays on the master report. It also leaves enough empty space to appear to indicate that something is being returned but just not displayed. When I set 'remove line when blank' for the subreport element in properties from the master report I get no rows - so apparently it is returning a blank line 44 times - one for each row. Or is it?
One suggestion was to remove the connection_expression and replace it with parameters_map_expression but that didn't help either.
My best guess is that the subreport data is not getting to the master for some reason. If anyone has any suggestions I am open to anything I can do with JasperSoftStudio 6.3.
Master report:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 -->
<!-- 2016-09-07T10:21: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="ITEMMRPT" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1aa96e89-cb24-464e-90bf-0d12bc48a516">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="staging"/>
<parameter name="billing_year" class="java.lang.Integer">
<defaultValueExpression><![CDATA[2015]]></defaultValueExpression>
</parameter>
<parameter name="billing_month" class="java.lang.Integer">
<defaultValueExpression><![CDATA[9]]></defaultValueExpression>
</parameter>
<parameter name="billing_day" class="java.lang.Integer">
<defaultValueExpression><![CDATA[1]]></defaultValueExpression>
</parameter>
<parameter name="report_type" class="java.lang.String">
<defaultValueExpression><![CDATA["DAILY"]]></defaultValueExpression>
</parameter>
<parameter name="area_cd" class="java.lang.String">
<defaultValueExpression><![CDATA["TACM"]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[exec createitembillingReport;1 #billing_year = $P{billing_year}, #billing_month = $P{billing_month}, #billing_day = $P{billing_day},#report_type=$P{report_type},#area_cd = $P{area_cd}]]>
</queryString>
<field name="item_id" class="java.lang.String"/>
<field name="item_name" class="java.lang.String"/>
<variable name="total" class="java.lang.Integer" calculation="Count">
<variableExpression><![CDATA[$F{item_id}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="67">
<staticText>
<reportElement x="60" y="33" width="242" height="17" uuid="06a14aaf-07b9-4894-bc60-0f5b3b254826">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="11"/>
</textElement>
<text><![CDATA[Item Listing]]></text>
</staticText>
<staticText>
<reportElement x="60" y="50" width="78" height="17" uuid="365238e1-9e5f-471b-92aa-aadab4fcfc31">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Billable as of :]]></text>
</staticText>
<textField>
<reportElement x="138" y="50" width="180" height="17" uuid="c735ec59-4e96-4b22-bf70-08af130efed9"/>
<textElement>
<font size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{billing_month}+"/"+$P{billing_day}+"/"+$P{billing_year}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="18">
<staticText>
<reportElement x="16" y="0" width="70" height="17" uuid="79476ab9-e5ea-40ec-b382-b22a0c5d355a">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Item ID]]></text>
</staticText>
<staticText>
<reportElement x="479" y="0" width="61" height="17" uuid="adb588f3-ed71-439a-acde-d812acee6a94">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Location]]></text>
</staticText>
<staticText>
<reportElement x="260" y="0" width="97" height="17" uuid="243ce68e-c532-4056-958e-08f7a0f83d2a">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Pull Date]]></text>
</staticText>
<staticText>
<reportElement x="89" y="0" width="87" height="17" uuid="ca299eb7-2aba-4529-ae76-3dfa4c6abe29">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Order Date]]></text>
</staticText>
<staticText>
<reportElement x="380" y="0" width="86" height="17" uuid="c220e72b-bd29-416a-95fc-c6c8a10ab081">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Ship Date]]></text>
</staticText>
<staticText>
<reportElement x="168" y="0" width="92" height="17" uuid="2ea414c5-4484-48dc-a6b5-52d4ab3ebd97">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Description]]></text>
</staticText>
<line>
<reportElement x="0" y="17" width="555" height="1" uuid="ab7d193f-96d3-454a-8fdd-5e0027425d42">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<subreport>
<reportElement isPrintRepeatedValues="false" mode="Transparent" x="0" y="4" width="555" height="16" uuid="6318f4b9-c420-4294-a63f-1a83d338f755">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreportParameter name="item_id">
<subreportParameterExpression><![CDATA[$F{item_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["report.jasper"]]></subreportExpression>
</subreport>
<textField>
<reportElement x="10" y="-1" width="100" height="16" uuid="91285585-7366-46c3-b248-9dbaf0c80839"/>
<textFieldExpression><![CDATA[$F{item_id}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="15">
<textField>
<reportElement x="110" y="0" width="100" height="15" uuid="54e9321a-c062-49f4-8b32-02f4c41458c0"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="210" y="0" width="100" height="15" uuid="00b215e9-ba28-413b-ad44-4c4a3aac7fdd"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[" of " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="400" y="-1" width="50" height="15" uuid="0dae2a30-28fe-4a71-9dc9-ec906ec05c78"/>
<text><![CDATA[Run Date :]]></text>
</staticText>
<textField pattern="MMMMM dd, yyyy">
<reportElement x="450" y="1" width="100" height="13" uuid="34cfa033-e43d-4668-852d-3019f322ea5a"/>
<textFieldExpression><![CDATA[new SimpleDateFormat("MMM dd, yyyy").format(TODAY())]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="18">
<textField>
<reportElement x="120" y="2" width="50" height="16" uuid="4a336320-9341-42dd-98c4-1cec2c2d6a15"/>
<textFieldExpression><![CDATA[$V{total}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="10" y="2" width="100" height="13" uuid="00887a5b-9421-402b-98b8-b041f08959f0">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<text><![CDATA[Total Items]]></text>
</staticText>
</band>
</summary>
Subreport:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 -->
<!-- 2016-09-07T10:37:50 -->
<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="report" pageWidth="555" pageHeight="802" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="9014add6-11f0-4647-97ec-9b9f3f78afce">
<parameter name="item_id" class="java.lang.String" isForPrompting="false"/>
<queryString language="SQL">
<![CDATA[select b.item_id,
b.order_dt,
cpnv.item_desc,
cpnv.pull_dt,
b.ship_dt,
location = (select bjc.location_cd
from warehouse_location bjc
where bjc.item = b.item_id
and bjc.location_start_dt =
(select max(location_start_dt)
from warehouse_location
where item_id = b.item_id))
from item_names cpnv
join items b
ON cpnv.sub_id = b.sub_id
where (ship_dt is null or ship_dt >= '1-24-16 22:00')
and b.item_id = $P{item_id}]]>
</queryString>
<field name="item_id" class="java.lang.String"/>
<field name="order_dt" class="java.sql.Timestamp"/>
<field name="item_desc" class="java.lang.String"/>
<field name="pull_dt" class="java.sql.Timestamp"/>
<field name="ship_dt" class="java.sql.Timestamp"/>
<field name="location" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="41" splitType="Stretch">
<textField isStretchWithOverflow="true" evaluationTime="Band" isBlankWhenNull="false">
<reportElement x="9" y="11" width="67" height="20" isPrintWhenDetailOverflows="true" uuid="12d147f8-532b-4ed5-a249-e03661099e4f">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$F{item_id}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Band" isBlankWhenNull="false">
<reportElement x="89" y="11" width="78" height="20" isPrintWhenDetailOverflows="true" uuid="76ea3e37-9b7a-44e3-a1ae-5850072b90ef">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[new SimpleDateFormat("MM/dd/yy hh:mm").format($F{order_dt})]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Band" isBlankWhenNull="false">
<reportElement x="168" y="11" width="156" height="20" isPrintWhenDetailOverflows="true" uuid="9ab7bd73-e633-4d51-8271-00c673750a38">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$F{item_desc}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Band" isBlankWhenNull="false">
<reportElement x="326" y="11" width="48" height="20" isPrintWhenDetailOverflows="true" uuid="b0ac4ef7-e951-4fb2-ab80-3b6dc3103764">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[new SimpleDateFormat("MM/dd/yy").format($F{pull_dt})]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Band" isBlankWhenNull="false">
<reportElement x="380" y="11" width="69" height="20" isPrintWhenDetailOverflows="true" uuid="83cb0048-4b23-42a9-a48d-63501a9f242d">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[new SimpleDateFormat("MM/dd/yy hh:mm").format($F{ship_dt})]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Band" isBlankWhenNull="false">
<reportElement x="479" y="11" width="54" height="20" isPrintWhenDetailOverflows="true" uuid="67a5bd0d-cd6d-4910-83d0-396fc36781d3">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$F{location}]]></textFieldExpression>
</textField>
</band>
</detail>
I changed some of the names of things for proprietary reasons. Hopefully they are consistent. If something doesn't jive it was probably lost in translation.
As noted the query works fine in the subreport. When i give it one of the item_ids from the procedure in the master report it displays all the fields correctly for that item. It just won't come through to the master report.
You could try to print the subreport parameter $P{item_id} in the title band of the subreport to check if the parameter passing works correctly.
Depending on the height of the main reports detail band, Maybe you have to remove the top and bottom margin of the subreport.

Can´t add new paragraphs to a Jasper Report document after build pressing ENTER key

I need to generate a jasper document that is editable by the user after build using the Microsoft Word. The problem I encounter is that once I generate the document, I can not add new paragraphs between the existing ones using the ENTER key. What happens is that the text disappears behind the subsequent paragraphs, hiding under.
I tried using the overflow property and stretch with no results.
EDIT (clarification from a comment): GenericJon response is useful but, Could be this Microsoft Word property be setted when building the document with jasper exporter in order to open the document with this cell height property setted?
Thanks in advance!
My java application uses jasperreports-4.5.1.jar
I´m compiling my template with Jaspersoft iReport Designer 5.0.4
I use Microsoft Word 2013 to edit the document after build.
Here is the XML report :
<?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="SolicitudPresupuestoCM" pageWidth="595" pageHeight="842" columnWidth="475" leftMargin="60" rightMargin="60" topMargin="20" bottomMargin="20" whenResourceMissingType="Key" uuid="255a457f-fbfa-4352-8d45-fb04f539febb">
<property name="ireport.zoom" value="1.2396694214876032"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<parameter name="DIRECTORIO_IMAGENES" class="java.lang.String" isForPrompting="false"/>
<parameter name="fechaPropuesta" class="java.util.Date" isForPrompting="false"/>
<parameter name="numParrafosPrimerTexto" class="java.lang.Integer" isForPrompting="false"/>
<parameter name="nombreFirma" class="java.lang.String" isForPrompting="false"/>
<parameter name="cargoFirma" class="java.lang.String" isForPrompting="false"/>
<parameter name="expediente" class="java.lang.String" isForPrompting="false"/>
<parameter name="objeto" class="java.lang.String" isForPrompting="false"/>
<parameter name="aplicacionPresupuestaria" class="java.lang.String" isForPrompting="false"/>
<parameter name="importe" class="java.lang.String" isForPrompting="false"/>
<parameter name="empresa" class="java.lang.String" isForPrompting="false"/>
<parameter name="cif" class="java.lang.String" isForPrompting="false"/>
<parameter name="numFactura" class="java.lang.String" isForPrompting="false"/>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<field name="texto" class="java.lang.String"/>
<variable name="index" class="java.lang.Integer" incrementType="Report">
<variableExpression><![CDATA[Integer.valueOf($V{index}.intValue() + 1)]]></variableExpression>
<initialValueExpression><![CDATA[Integer.valueOf(0)]]></initialValueExpression>
</variable>
<pageHeader>
<band height="101" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="dfc390b7-4917-47da-970f-d9e69de9626d" x="355" y="79" width="121" height="14"/>
<textElement>
<font fontName="Arial" size="8" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{expediente}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="23" splitType="Stretch">
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false">
<reportElement uuid="4fb4251a-765e-47b6-bd8d-60690d8df47a" x="0" y="0" width="475" height="10" isRemoveLineWhenBlank="true"/>
<textElement textAlignment="Justified">
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{texto}]]></textFieldExpression>
</textField>
</band>
<band height="73" splitType="Stretch">
<staticText>
<reportElement uuid="d0ec9d8d-de99-4b1f-a5f2-bd43b7ddd478" isPrintRepeatedValues="false" x="0" y="0" width="221" height="14" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[OBJECT: Payment of the invoice number]]></text>
</staticText>
<staticText>
<reportElement uuid="f8151046-97b5-452c-9423-50eea1b9f5d3" isPrintRepeatedValues="false" x="0" y="14" width="60" height="14" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[AMOUNT:]]></text>
</staticText>
<staticText>
<reportElement uuid="2fa9090a-0ecd-4084-8947-48bfc161bd16" isPrintRepeatedValues="false" x="0" y="28" width="73" height="15" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[APLICATION:]]></text>
</staticText>
<staticText>
<reportElement uuid="3abdff65-88a4-4201-af12-2d89c9e9b2cd" isPrintRepeatedValues="false" x="0" y="43" width="100" height="15" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[BIDDER:]]></text>
</staticText>
<staticText>
<reportElement uuid="eecdd67b-eb52-47e3-ae9e-fd5be9f0578e" isPrintRepeatedValues="false" x="335" y="43" width="47" height="15" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[NIF/CIF:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="45e2af4d-aa76-4d8a-b736-09b9298b24c1" isPrintRepeatedValues="false" x="60" y="14" width="415" height="14" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{importe}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="0a69cee5-7970-4972-9b74-ebc4fe6687d5" isPrintRepeatedValues="false" x="77" y="28" width="306" height="15" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{aplicacionPresupuestaria}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="ea832f4b-30cd-4240-84dd-c39a01674540" isPrintRepeatedValues="false" x="100" y="43" width="235" height="15" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{empresa}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="291d18a5-4e09-41af-81ef-38da536f868b" isPrintRepeatedValues="false" x="383" y="43" width="92" height="15" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{cif}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="15cc14e4-06ec-4c5f-92ff-5f7261bc83f8" isPrintRepeatedValues="false" x="221" y="0" width="58" height="14" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{numFactura}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="9e5ab1d9-008f-44c5-b25a-c95184f1ff1b" isPrintRepeatedValues="false" x="279" y="0" width="86" height="14" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[realtive to]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="7c57f57d-033d-4e85-8f18-d2f40521e5b3" isPrintRepeatedValues="false" x="365" y="0" width="110" height="14" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{objeto}]]></textFieldExpression>
</textField>
</band>
<band height="85" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="386f28db-aa1e-46e8-8c31-dd01a5c041c8" x="0" y="20" width="475" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{cargoFirma}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="d4e52606-aaf0-48a8-8dd3-b1532b0f5eed" key="staticText" isPrintRepeatedValues="false" x="0" y="0" width="135" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Somewhere,]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement uuid="a8ceb09b-bc70-4875-90de-877cf9889351" isPrintRepeatedValues="false" x="0" y="65" width="475" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{nombreFirma}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="71a758b9-a5bc-4890-ae2f-74263245d0c4" isPrintRepeatedValues="false" x="135" y="0" width="220" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{fechaPropuesta}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="122">
<staticText>
<reportElement uuid="47118a66-c23c-4b35-b90f-7e469eb97a99" key="staticText" x="0" y="0" width="73" height="20"/>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Otherwhere,]]></text>
</staticText>
<staticText>
<reportElement uuid="880fd5a8-8a35-49d2-b226-5413d7d02120" key="staticText" x="0" y="20" width="475" height="20"/>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[The director of ...]]></text>
</staticText>
<staticText>
<reportElement uuid="6a5f6b70-0574-4c6f-8e44-09356eda2a51" key="staticText" x="0" y="71" width="475" height="20"/>
<textElement>
<font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Charles Irwin]]></text>
</staticText>
</band>
</pageFooter>
</jasperReport>
Here is the result document that I should easily customize after build.
Go to download document
The row will re-size when you write to it, when you add the net.sf.jasperreports.export.docx.flexible.row.height property to the report with the true value.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport ...>
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.docx.flexible.row.height" value="true"/>
More Info about property:
Link
NOTE: you should think on paradigm, that reports are "read only". So users should fill data into some programmatic form and afterwards the reports is generated ...
JasperReports achieves the layout of the document by using a table. In MS Word, you should be able to see this by selecting Table Tools > Layout > Show Gridlines. All of the rows have a specific fixed height, so when you add more content beyond the size of a cell, it will not be visible.
To enable the cells to grow as you add new paragraphs, right-click inside the cell you want to add content to, and select Table Properties.... On the Row tab, un-check the box next to Specify Height. The row height should then increase to accommodate the contents.