报告末尾有额外的空白页 JasperReports

问题描述 投票:0回答:3

我的 PDF 末尾有一个额外的白色空白页,我已经阅读了其他主题,但解决方案对我不起作用。它来自代码(见下文)还是我必须更改属性中的内容?如果需要的话我可以加入 PDF。

这是我的 JXML 文件:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="annoncePDF" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true" uuid="6fa761b0-29ca-4e21-bff3-85bd1fcb6425">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <parameter name="imgPath" class="java.lang.String">
        <parameterDescription><![CDATA[imgPath]]></parameterDescription>
    </parameter>
    <field name="price" class="java.lang.String">
        <fieldDescription><![CDATA[price]]></fieldDescription>
    </field>
    <field name="description" class="java.lang.String">
        <fieldDescription><![CDATA[description]]></fieldDescription>
    </field>
    <field name="localization" class="java.lang.String">
        <fieldDescription><![CDATA[localization]]></fieldDescription>
    </field>
    <field name="img1" class="java.lang.String">
        <fieldDescription><![CDATA[img1]]></fieldDescription>
    </field>
    <field name="img2" class="java.lang.String">
        <fieldDescription><![CDATA[img2]]></fieldDescription>
    </field>
    <field name="img3" class="java.lang.String">
        <fieldDescription><![CDATA[img3]]></fieldDescription>
    </field>
    <field name="img4" class="java.lang.String">
        <fieldDescription><![CDATA[img4]]></fieldDescription>
    </field>
    <field name="agencyLogo" class="java.lang.String">
        <fieldDescription><![CDATA[agencyLogo]]></fieldDescription>
    </field>
    <field name="bidType" class="java.lang.String">
        <fieldDescription><![CDATA[bidType]]></fieldDescription>
    </field>
    <field name="realtyType" class="java.lang.String">
        <fieldDescription><![CDATA[realtyType]]></fieldDescription>
    </field>
    <field name="realtyCategory" class="java.lang.String">
        <fieldDescription><![CDATA[realtyCategory]]></fieldDescription>
    </field>
    <field name="contactPhone" class="java.lang.String">
        <fieldDescription><![CDATA[contactPhone]]></fieldDescription>
    </field>
    <field name="monthlycharges" class="java.lang.String">
        <fieldDescription><![CDATA[monthlycharges]]></fieldDescription>
    </field>
    <detail>
        <band height="842" splitType="Stretch">
            <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
            <image scaleImage="FillFrame">
                <reportElement x="0" y="0" width="595" height="842" uuid="96dba386-3a03-44cb-84a8-34d76c4be108"/>
                <imageExpression><![CDATA[$P{imgPath}+"/annoncePDF/template.jpg"]]></imageExpression>
            </image>
            <frame>
                <reportElement stretchType="ElementGroupBottom" mode="Transparent" x="0" y="138" width="595" height="257" backcolor="#FFFFFF" uuid="b39d04cd-1bfb-4211-96b7-e6123ff0679c">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <image scaleImage="FillFrame" hAlign="Left" onErrorType="Blank">
                    <reportElement mode="Transparent" x="0" y="0" width="595" height="257" backcolor="#FFFFFF" uuid="4e070521-7016-40bd-95ea-57a8d4146c71">
                        <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    </reportElement>
                    <imageExpression><![CDATA[$F{img1} != null? $F{img1}:$F{agencyLogo}]]></imageExpression>
                </image>
            </frame>
            <frame>
                <reportElement x="396" y="407" width="177" height="132" uuid="44246b8b-246b-4752-8e5a-11b6c277506b">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <image scaleImage="FillFrame" onErrorType="Blank">
                    <reportElement x="0" y="0" width="177" height="132" uuid="8a5eb8b7-d0dc-4c87-a1ec-664eeab9d2bc">
                        <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    </reportElement>
                    <imageExpression><![CDATA[$F{img4} != null? $F{img4}:$F{agencyLogo}]]></imageExpression>
                </image>
            </frame>
            <frame>
                <reportElement x="209" y="407" width="177" height="132" uuid="b4536946-0dfb-4a02-a7c0-09b3f478d1f4">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <image scaleImage="FillFrame" hAlign="Center" vAlign="Middle" onErrorType="Blank">
                    <reportElement x="0" y="0" width="177" height="132" uuid="021c1644-08c7-4b57-8abc-732a7da7a9e2">
                        <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    </reportElement>
                    <imageExpression><![CDATA[$F{img3} == null?$F{agencyLogo}:$F{img3}]]></imageExpression>
                </image>
            </frame>
            <frame>
                <reportElement x="22" y="407" width="177" height="132" uuid="45f9926e-65b2-4dad-a064-ce3c47156c3d">
                    <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="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <image scaleImage="FillFrame" onErrorType="Blank">
                    <reportElement x="0" y="0" width="177" height="132" uuid="b3efbb40-47e9-437f-8451-f062d7c8ddd5">
                        <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    </reportElement>
                    <imageExpression><![CDATA[$F{img2} != null? $F{img2}:$F{agencyLogo}]]></imageExpression>
                </image>
            </frame>
            <frame>
                <reportElement x="36" y="5" width="220" height="131" uuid="452b32ba-ca1b-4eb6-8522-93dd7282f5b2">
                    <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"/>
                </reportElement>
                <image scaleImage="FillFrame" onErrorType="Blank">
                    <reportElement x="17" y="0" width="150" height="131" uuid="c2241dfb-418d-4f0f-b3df-992cbab841e7">
                        <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    </reportElement>
                    <imageExpression><![CDATA[$F{agencyLogo}]]></imageExpression>
                </image>
            </frame>
            <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
                <reportElement key="" x="270" y="30" width="290" height="34" forecolor="#474747" uuid="1fdc3005-be65-4654-9d21-c77757d2152e">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Right" rotation="None" markup="html">
                    <font fontName="Lato" size="32" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
                </textElement>
                <textFieldExpression><![CDATA[($F{bidType}.equals(null)?" ": $F{bidType}.toUpperCase())]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement key="" x="232" y="64" width="328" height="30" forecolor="#303030" uuid="e49ee12b-de88-488b-b8c5-8cfb16711c3c"/>
                <textElement textAlignment="Right" markup="html">
                    <font fontName="Lato" size="32" isBold="true" isItalic="false"/>
                </textElement>
                <textFieldExpression><![CDATA[($F{realtyCategory}.equals(null)?" ": $F{realtyCategory}.toUpperCase())+" "+
($F{realtyType}.equals(null)?" ": $F{realtyType}.toUpperCase())]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement key="" x="232" y="102" width="328" height="29" forecolor="#303030" uuid="7f9a97b2-6f5e-417a-883e-79ae479cdeac"/>
                <textElement textAlignment="Right" markup="html">
                    <font fontName="Lato" size="18" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[($F{localization}.equals(null)?"":$F{localization}.toUpperCase())]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="260" y="558" width="300" height="160" forecolor="#424242" uuid="4a3c8f67-272b-4e71-b92d-62d2bbec64ee"/>
                <textElement textAlignment="Justified" verticalAlignment="Middle">
                    <font fontName="Lato Light" size="11"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="30" y="555" width="202" height="85" forecolor="#1F1F1F" uuid="1eb1157b-465d-4aec-9e58-86dc466d5426">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Bottom">
                    <font fontName="Lato" size="23" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[($F{realtyCategory}.equals(null)?" ": $F{realtyCategory}.toUpperCase())+" "+
($F{realtyType}.equals(null)?" ": $F{realtyType}.toUpperCase())]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="30" y="637" width="202" height="73" forecolor="#1F1F1F" uuid="be6f9a34-e913-4688-b18b-d2acbdc8aaba"/>
                <textElement textAlignment="Center">
                    <font fontName="Lato" size="15" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[($F{localization}.equals(null)?" ": $F{localization}.toUpperCase())+" "]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="36" y="744" width="300" height="40" forecolor="#FFFFFF" uuid="bac07815-d9bf-4635-b7ee-aec8ddfad740"/>
                <textElement markup="html">
                    <font fontName="Lato" size="29" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["Prix : "+$F{price}+".CFP "+($F{monthlycharges}.equals("")?"": "+ "+$F{monthlycharges}+"CFP " +" de charges mensuelles")]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="215" y="745" width="354" height="34" forecolor="#FFFFFF" uuid="bf153f40-3d6a-474e-ae02-d562e6d43844"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font fontName="Lato" size="21" isBold="true"/>
                    <paragraph leftIndent="0" rightIndent="5"/>
                </textElement>
                <textFieldExpression><![CDATA["Contact "+$F{contactPhone}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>

如有任何帮助,我们将不胜感激。我不明白为什么最后有一个空白页。我检查了图像的大小,没有一个比页面本身大。

谢谢,

尼古拉斯

jasper-reports
3个回答
1
投票

在我的例子中,我将所有列表组件放入框架中 这解决了我的问题。


0
投票

我发现问题了!

它不是来自 JXML 文件,而是来自 JXML 的属性。我必须点击

忽略分页

谢谢。


0
投票

在详细信息带 1 中添加子报表,并在另一个详细信息带 2 中添加其他拉伸元素(例如表格)。 未生成最后的空白页。

这对我有用!

© www.soinside.com 2019 - 2024. All rights reserved.