Detail Band Auto-Height / Dynamically Height when lists in lists included

0
Hello everybody,
we've got the Problem that the detail Band doesn't fit dynamically Height if thers Lists in Lists included.
 
Here my Code:
<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="contactInformation" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="0" whenResourceMissingType="Empty" uuid="11d17921-548c-4054-a4c2-9f3820dea463">
<template><![CDATA["jasper-templates/promis-styles.jrtx"]]></template>
<subDataset name="packagingMarking" uuid="98b0a279-cabd-44a4-8657-a3cd838b94c3">
<queryString language="JSON">
<![CDATA[]]>
</queryString>
<field name="packageDateReasonTypeLabel" class="java.lang.String">
<fieldDescription><![CDATA[packageDateReasonType.label]]></fieldDescription>
</field>
<field name="packageDateReasonType" class="java.lang.String">
<fieldDescription><![CDATA[packageDateReasonType.value]]></fieldDescription>
</field>
<field name="isPriceOnPackLabel" class="java.lang.String">
<fieldDescription><![CDATA[isPriceOnPack.label]]></fieldDescription>
</field>
<field name="isPriceOnPack" class="java.lang.String">
<fieldDescription><![CDATA[isPriceOnPack.value]]></fieldDescription>
</field>
<field name="isMarkedWithIngredientsLabel" class="java.lang.String">
<fieldDescription><![CDATA[isMarkedWithIngredients.label]]></fieldDescription>
</field>
<field name="isMarkedWithIngredients" class="java.lang.String">
<fieldDescription><![CDATA[isMarkedWithIngredients.value]]></fieldDescription>
</field>
<field name="isRfidOnPackagingLabel" class="java.lang.String">
<fieldDescription><![CDATA[isRfidOnPackaging.label]]></fieldDescription>
</field>
<field name="isRfidOnPackaging" class="java.lang.String">
<fieldDescription><![CDATA[isRfidOnPackaging.value]]></fieldDescription>
</field>
<field name="refundObligationNameLabel" class="java.lang.String">
<fieldDescription><![CDATA[refundObligationName.label]]></fieldDescription>
</field>
<field name="refundObligationName" class="java.lang.String">
<fieldDescription><![CDATA[refundObligationName.value]]></fieldDescription>
</field>
<field name="zasPackagingMarkedLabel" class="java.lang.String">
<fieldDescription><![CDATA[zasPackagingMarked.label]]></fieldDescription>
</field>
</subDataset>
<subDataset name="packagingMarked" uuid="6d404f58-e5cc-4b8f-82e6-947d84e4e95e">
<queryString language="JSON">
<![CDATA[]]>
</queryString>
<field name="languageLabel" class="java.lang.String">
<fieldDescription><![CDATA[language.label]]></fieldDescription>
</field>
<field name="language" class="java.lang.String">
<fieldDescription><![CDATA[language.value]]></fieldDescription>
</field>
</subDataset>
<queryString language="json">
<![CDATA[]]>
</queryString>
<field name="group_packagingDate" class="java.lang.String">
<fieldDescription><![CDATA[categories.group_packaging_marking_date]]></fieldDescription>
</field>
<field name="categoryPackagingMarking" class="java.lang.String">
<fieldDescription><![CDATA[categories.category_packaging_marking]]></fieldDescription>
</field>
<detail>
<band height="108" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<textField>
<reportElement style="promis_module_header" positionType="Float" mode="Opaque" x="0" y="0" width="555" height="20" isRemoveLineWhenBlank="true" backcolor="#C7C7C7" uuid="8f69f860-46a8-4cc3-b697-44211ffdbaa1">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
<paragraph firstLineIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{categoryPackagingMarking}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="promis_group_header" positionType="Float" mode="Opaque" x="0" y="20" width="555" height="11" backcolor="#C7C7C7" uuid="61e279b2-8edf-4be4-bfdd-5d6c52e3300b">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{group_packagingDate}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="31" width="555" height="77" isRemoveLineWhenBlank="true" uuid="3e648f30-ddf0-49d5-b61f-bc3b6adc48be">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value="packagingMarking"/>
</reportElement>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Horizontal">
<datasetRun subDataset="packagingMarking" uuid="620b8bfa-ff27-4f52-95ff-821387f673da">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("ZasPackagingMarking")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="77" width="555">
<textField isStretchWithOverflow="true">
<reportElement style="promis_label" positionType="Float" x="0" y="0" width="280" height="11" isRemoveLineWhenBlank="true" uuid="9506114e-6c33-43ca-8985-f002cc992904">
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{packageDateReasonTypeLabel}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_text" positionType="Float" x="280" y="0" width="275" height="11" isRemoveLineWhenBlank="true" uuid="56d9b472-6a68-44cf-9a5d-9389be152df9">
	<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{packageDateReasonType}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_label" positionType="Float" x="0" y="11" width="280" height="11" isRemoveLineWhenBlank="true" uuid="f0ac2689-3ad1-4994-b0f7-73eb9a85c8ca">
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{isPriceOnPackLabel}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_text" positionType="Float" x="280" y="11" width="275" height="11" isRemoveLineWhenBlank="true" uuid="7fbd82e8-5a37-4d6f-8c44-04000627d692">
	<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{isPriceOnPack}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_label" positionType="Float" x="0" y="22" width="280" height="11" isRemoveLineWhenBlank="true" uuid="ffcae0c3-cca8-4770-a8be-3e887f3f8ad9">
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{isMarkedWithIngredientsLabel}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_text" positionType="Float" x="280" y="22" width="275" height="11" isRemoveLineWhenBlank="true" uuid="cb3925c9-1010-4581-aaf8-42cf24fcb6aa">
	<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{isMarkedWithIngredients}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_label" positionType="Float" x="0" y="33" width="280" height="11" isRemoveLineWhenBlank="true" uuid="1e5b53fe-0013-4a0f-9537-13b70d657b7f">
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{isRfidOnPackagingLabel}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_text" positionType="Float" x="280" y="33" width="275" height="11" isRemoveLineWhenBlank="true" uuid="3043392a-829b-4a8e-9eeb-19cd301c76d6">
	<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{isRfidOnPackaging}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_label" positionType="Float" x="0" y="44" width="280" height="11" isRemoveLineWhenBlank="true" uuid="0eb55684-8b96-4ef9-b316-d0cc6a79cbd7">
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{refundObligationNameLabel}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_text" positionType="Float" x="280" y="44" width="275" height="11" isRemoveLineWhenBlank="true" uuid="b17cbdac-d109-4709-ba6d-955c44e4f5a2">
	<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{refundObligationName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="promis_group_header" positionType="Float" mode="Opaque" x="0" y="55" width="555" height="11" isRemoveLineWhenBlank="true" backcolor="#C7C7C7" uuid="e27de7aa-2568-4ca8-bee3-2f9f89615ac0">
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
	<printWhenExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("ZasPackagingMarked") != null]]></printWhenExpression>
</reportElement>
<box>
	<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
	<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
</box>
<textElement verticalAlignment="Middle">
	<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{zasPackagingMarkedLabel}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="66" width="555" height="11" isRemoveLineWhenBlank="true" uuid="d56aaec0-315a-45db-9a67-47672667fc58">
	<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
	<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
	<property name="net.sf.jasperreports.export.headertoolbar.table.name" value="packagingMarked"/>
	<printWhenExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("ZasPackagingMarked") != null]]></printWhenExpression>
</reportElement>
<jr:list printOrder="Vertical">
	<datasetRun subDataset="packagingMarked" uuid="055a34f0-929c-41a7-b010-d4893de48611">
		<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("ZasPackagingMarked")]]></dataSourceExpression>
	</datasetRun>
	<jr:listContents height="11" width="555">
		<textField isStretchWithOverflow="true" isBlankWhenNull="true">
			<reportElement style="promis_label" positionType="Float" x="0" y="0" width="280" height="11" uuid="d4267c22-b608-4511-978b-e426dd892f67">
				<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
				<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
				<printWhenExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("ZasPackagingMarked") != null]]></printWhenExpression>
			</reportElement>
			<box>
				<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
				<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
				<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
				<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
			</box>
			<textElement verticalAlignment="Middle">
				<paragraph leftIndent="10"/>
			</textElement>
			<textFieldExpression><![CDATA[$F{languageLabel}]]></textFieldExpression>
		</textField>
		<textField isStretchWithOverflow="true" isBlankWhenNull="true">
			<reportElement style="promis_text" positionType="Float" x="280" y="0" width="275" height="11" isRemoveLineWhenBlank="true" uuid="068c2069-5611-4742-8ffd-19048611e949">
				<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
				<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
				<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
				<printWhenExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("ZasPackagingMarked") != null]]></printWhenExpression>
			</reportElement>
			<box>
				<topPen lineWidth="1.0" lineColor="#C7C7C7"/>
				<leftPen lineWidth="1.0" lineColor="#C7C7C7"/>
				<bottomPen lineWidth="1.0" lineColor="#C7C7C7"/>
				<rightPen lineWidth="1.0" lineColor="#C7C7C7"/>
			</box>
			<textElement verticalAlignment="Middle">
				<paragraph leftIndent="10"/>
			</textElement>
			<textFieldExpression><![CDATA[$F{language}]]></textFieldExpression>
		</textField>
	</jr:listContents>
</jr:list>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
</jasperReport>

See my Screenshots: Theres a packagingMarking List wich includes an packagingMarked (Language) List:
So if no language exists it should be removed, and the List and Detail Band should auto Height:
So it looks in the PDF. Theres a whitespace. I try to remove the White by "Remove Line with Blank", "Print When Expressions", and set all Elements as "Stretch with Overflow" and Postion Type "Float".
I think the Lists work dynamically but the Detail Band has an fix value of 108px and does not behave dynamically.
I try a lot of Configurations but it does not work :(
This is the minimal usecase, but we've got already Lists with more than 3 included Lists and there is the whitespace even bigger.
I hope you have an Soultion for me.
Best Regards,
Anton
anton.lapko's picture
Joined: Jul 29 2017 - 1:45am
Last seen: 2 years 3 months ago

0 Answers:

No answers yet
Feedback