使用两列并通过JasperReport横向打印时裁剪页面

时间:2018-07-10 17:37:57

标签: java jasper-reports

我正在使用:JasperSoft Studio 6.6.0,JasperReport库6.6.0,Java(1.8.0_161),Eclipse和Windows 10 Ultimate 64位。

我有一个报告,其中显示有关债务(主报告)及其付款(子报告,在主报告内部)的信息,并且还显示其他一些债务(子报告,在上一个子报告内部)。我在子报表中使用两列(columnCount = 2)和水平打印(printOrder = Horizo​​ntal)。

当我有足够的数据(多于1行)填充所有列时,它会正确打印: correct

但是当我只需要打印一行(两个子报表)时,它将裁剪一部分页面: wrong

主要Report.jrxml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="cupomvenda" columnCount="2" printOrder="Horizontal" pageWidth="206" pageHeight="842" whenNoDataType="NoPages" columnWidth="93" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" isSummaryNewPage="true" isFloatColumnFooter="true" isIgnorePagination="true" uuid="2da14062-f42f-4e5c-871c-6d8a6aadb951">
    <property name="ireport.zoom" value="2.1435888100000016"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="369"/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <import value="jvs.emitente.model.Emitente"/>
    <style name="center" hTextAlign="Center" hImageAlign="Center"/>
    <parameter name="DADOS_SUB" class="java.util.Set">
        <parameterDescription><![CDATA[DADOS_SUB]]></parameterDescription>
    </parameter>
    <parameter name="PARAMS_SUB" class="java.util.HashMap">
        <parameterDescription><![CDATA[PARAMS_SUB]]></parameterDescription>
    </parameter>
    <parameter name="SUB" class="java.lang.Object">
        <parameterDescription><![CDATA[SUB]]></parameterDescription>
    </parameter>
    <parameter name="ENDERECO" class="java.lang.String">
        <parameterDescription><![CDATA[ENDERECO]]></parameterDescription>
    </parameter>
    <parameter name="NOMEFANTASIA" class="java.lang.String">
        <parameterDescription><![CDATA[NOMEFANTASIA]]></parameterDescription>
    </parameter>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="id" class="java.lang.Integer">
        <fieldDescription><![CDATA[id]]></fieldDescription>
    </field>
    <field name="cliente" class="jvs.emitente.model.Emitente">
        <fieldDescription><![CDATA[cliente]]></fieldDescription>
    </field>
    <field name="dataEmissao" class="java.sql.Date">
        <fieldDescription><![CDATA[dataEmissao]]></fieldDescription>
    </field>
    <field name="dataVencimento" class="java.sql.Date">
        <fieldDescription><![CDATA[dataVencimento]]></fieldDescription>
    </field>
    <field name="valor" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valor]]></fieldDescription>
    </field>
    <field name="valorSaldo" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valorSaldo]]></fieldDescription>
    </field>
    <field name="valorJuros" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valorJuros]]></fieldDescription>
    </field>
    <field name="valorBaixas" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valorBaixas]]></fieldDescription>
    </field>
    <pageHeader>
        <band height="102" splitType="Stretch">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="11" width="186" height="10" uuid="c81802f6-667d-4569-a4c2-4146176648d5">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center">
                    <font fontName="Arial" size="8" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{NOMEFANTASIA}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="21" width="186" height="9" uuid="13ee30cd-caf8-4dd4-8dce-ad9f342bbcbf">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center">
                    <font fontName="Arial Narrow" size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{ENDERECO}]]></textFieldExpression>
            </textField>
            <line>
                <reportElement x="0" y="30" width="186" height="1" uuid="045313ce-2df2-44d7-8604-96b3dc7dbac7">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.5"/>
                </graphicElement>
            </line>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="34" width="186" height="9" uuid="b73f5588-61f7-4c6c-9222-dc8456d517c4">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["CÓDIGO: "+$F{id}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="0" y="0" width="186" height="10" uuid="8e4f623d-5f5a-441e-ab9a-71d6622145c7">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center">
                    <font fontName="Arial" size="8" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["RECIBO DE PAGAMENTO"]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="43" width="186" height="9" uuid="98fe420e-8e61-4b93-abb4-da656e396f83">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["CLIENTE: "+$F{cliente}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="0" y="52" width="30" height="9" uuid="dc91e67b-3003-4edd-bf70-c8653afa8836">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["DATA: "]]></textFieldExpression>
            </textField>
            <line>
                <reportElement x="0" y="10" width="186" height="1" uuid="bd578431-12d2-4e3e-a28c-f16eb3727efd">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.5"/>
                </graphicElement>
            </line>
            <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
                <reportElement x="30" y="52" width="153" height="9" uuid="cc8a8ca4-48a3-421b-9284-c6f3d94956db">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dataEmissao}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="0" y="61" width="30" height="9" uuid="95527bf5-e637-4f36-9440-0ace41862eb0">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["VCTO.: "]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
                <reportElement x="30" y="61" width="153" height="9" uuid="f464ba35-ab5a-48f2-8dcd-ef10cb10d749">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dataVencimento}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="0" y="74" width="40" height="9" uuid="a63e561d-6044-41d2-859b-1d1e55e2e019">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["VALOR R$"]]></textFieldExpression>
            </textField>
            <textField pattern="#,#00.00;-#,#00.00" isBlankWhenNull="true">
                <reportElement x="0" y="83" width="40" height="9" uuid="d9492dc7-e229-474c-b4e9-dc13e25f23e9">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valor}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="50" y="74" width="40" height="9" uuid="e5d68826-2726-4ba7-9511-1b5ce3849d18">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["JUROS R$"]]></textFieldExpression>
            </textField>
            <textField pattern="#,#00.00;-#,#00.00" isBlankWhenNull="true">
                <reportElement x="50" y="83" width="40" height="9" uuid="6a1b6f37-6de9-48e5-abe8-f918e4308d10">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valorJuros}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="96" y="74" width="40" height="9" uuid="07575d8f-57ea-4c2e-afb8-e417f694764d">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["SALDO R$"]]></textFieldExpression>
            </textField>
            <textField pattern="#,#00.00;-#,#00.00" isBlankWhenNull="true">
                <reportElement x="96" y="83" width="40" height="9" uuid="a249d4e8-7712-409c-ad5a-8a95e7416283">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valorSaldo}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="146" y="74" width="40" height="9" uuid="53b69ba0-2bf4-47e5-a4bc-014c8a991d16">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["PAGO R$"]]></textFieldExpression>
            </textField>
            <textField pattern="#,#00.00;-#,#00.00" isBlankWhenNull="true">
                <reportElement x="146" y="83" width="40" height="9" uuid="2ea9452a-a51d-4ed9-b019-e36797701023">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valorBaixas}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <detail>
        <band height="23">
            <printWhenExpression><![CDATA[$V{REPORT_COUNT} == -2]]></printWhenExpression>
        </band>
    </detail>
    <summary>
        <band height="20">
            <subreport overflowType="Stretch">
                <reportElement x="0" y="0" width="186" height="20" uuid="9eb09fb1-4565-486e-9b92-69794bde5bab"/>
                <parametersMapExpression><![CDATA[$P{PARAMS_SUB}]]></parametersMapExpression>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{DADOS_SUB})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUB}]]></subreportExpression>
            </subreport>
        </band>
    </summary>
</jasperReport>

付款的subreport.jrxml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="cupomvenda" columnCount="2" printOrder="Horizontal" pageWidth="186" pageHeight="812" whenNoDataType="NoDataSection" columnWidth="91" columnSpacing="4" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isSummaryNewPage="true" isFloatColumnFooter="true" isIgnorePagination="true" uuid="2da14062-f42f-4e5c-871c-6d8a6aadb951">
    <property name="ireport.zoom" value="2.1435888100000016"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="369"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <style name="center" hTextAlign="Center" hImageAlign="Center"/>
    <parameter name="DADOS_SUB" class="java.util.List">
        <parameterDescription><![CDATA[DADOS_SUB]]></parameterDescription>
    </parameter>
    <parameter name="PARAMS_SUB" class="java.util.HashMap">
        <parameterDescription><![CDATA[PARAMS_SUB]]></parameterDescription>
    </parameter>
    <parameter name="SUB" class="java.lang.Object">
        <parameterDescription><![CDATA[SUB]]></parameterDescription>
    </parameter>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="data" class="java.sql.Timestamp">
        <fieldDescription><![CDATA[data]]></fieldDescription>
    </field>
    <field name="valor" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valor]]></fieldDescription>
    </field>
    <field name="valorAcrescimo" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valorAcrescimo]]></fieldDescription>
    </field>
    <title>
        <band height="11">
            <staticText>
                <reportElement x="0" y="0" width="176" height="10" uuid="01411ab5-d046-4891-9d1f-2183f3a2d55e">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <text><![CDATA[PAGAMENTOS]]></text>
            </staticText>
            <line>
                <reportElement x="0" y="10" width="186" height="1" uuid="6aab7a07-4160-46fd-ad21-fb3b566a73fc">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.5"/>
                </graphicElement>
            </line>
        </band>
    </title>
    <columnHeader>
        <band height="8" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="32" height="8" uuid="34103b44-9a4b-44eb-abb4-eeb06e010968">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[DATA]]></text>
            </staticText>
            <staticText>
                <reportElement x="32" y="0" width="28" height="8" uuid="d4cf8d36-1efc-4ed5-91bf-5b001e4fd612">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Right">
                    <font fontName="Arial" size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[VALOR R$]]></text>
            </staticText>
            <staticText>
                <reportElement x="60" y="0" width="31" height="8" uuid="5b0751bd-ad83-44f9-aa13-c6f70df04902">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Right">
                    <font fontName="Arial" size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[ACRÉSC.]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="8" splitType="Stretch">
            <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
                <reportElement x="0" y="0" width="32" height="8" uuid="d89c64d7-e7ba-4536-9e4b-4ed6cc6cb329">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font fontName="Arial" size="6" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
            </textField>
            <textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
                <reportElement style="center" x="32" y="0" width="28" height="8" uuid="e4275fcb-323b-4171-a0ae-742d94eda92e">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <printWhenExpression><![CDATA[$F{valor} != null && $F{valor}.doubleValue() > 0.0]]></printWhenExpression>
                </reportElement>
                <textElement textAlignment="Right">
                    <font fontName="Arial" size="6" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valor}]]></textFieldExpression>
            </textField>
            <textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
                <reportElement x="60" y="0" width="31" height="8" uuid="f0c9150b-1918-49cc-8115-047e4446338f">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <printWhenExpression><![CDATA[$F{valorAcrescimo} != null && $F{valorAcrescimo}.doubleValue() > 0.0]]></printWhenExpression>
                </reportElement>
                <textElement textAlignment="Right">
                    <font fontName="Arial" size="6" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valorAcrescimo}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <summary>
        <band height="27">
            <line>
                <reportElement x="0" y="1" width="186" height="1" uuid="04c16fce-e057-4fb0-874f-b4b877cf4222">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.5"/>
                </graphicElement>
            </line>
            <subreport overflowType="Stretch">
                <reportElement x="0" y="7" width="186" height="20" uuid="91020e9b-520d-44bb-a4b6-5cbf808bcd8a"/>
                <parametersMapExpression><![CDATA[$P{PARAMS_SUB}]]></parametersMapExpression>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{DADOS_SUB})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUB}]]></subreportExpression>
            </subreport>
        </band>
    </summary>
    <noData>
        <band height="20">
            <subreport overflowType="Stretch">
                <reportElement x="0" y="0" width="186" height="20" uuid="6d1d1c05-b0bc-4da8-940a-e21dc662e386"/>
                <parametersMapExpression><![CDATA[$P{PARAMS_SUB}]]></parametersMapExpression>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{DADOS_SUB})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUB}]]></subreportExpression>
            </subreport>
        </band>
    </noData>
</jasperReport>

其他债务的subreport.jrxml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="cupomvenda" language="groovy" columnCount="2" printOrder="Horizontal" pageWidth="186" pageHeight="812" whenNoDataType="NoDataSection" columnWidth="91" columnSpacing="4" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isSummaryNewPage="true" isFloatColumnFooter="true" isIgnorePagination="true" uuid="2da14062-f42f-4e5c-871c-6d8a6aadb951">
    <property name="ireport.zoom" value="2.1435888100000016"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="369"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <style name="center" hTextAlign="Center" hImageAlign="Center"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="dataVencimento" class="java.sql.Date">
        <fieldDescription><![CDATA[dataVencimento]]></fieldDescription>
    </field>
    <field name="valorSaldo" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[valorSaldo]]></fieldDescription>
    </field>
    <title>
        <band height="13">
            <staticText>
                <reportElement x="0" y="0" width="176" height="10" uuid="01411ab5-d046-4891-9d1f-2183f3a2d55e">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="7" isBold="true"/>
                </textElement>
                <text><![CDATA[PARCELAS PENDENTES (OUTRAS VENDAS)]]></text>
            </staticText>
            <line>
                <reportElement x="0" y="10" width="186" height="1" uuid="6aab7a07-4160-46fd-ad21-fb3b566a73fc">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.5"/>
                </graphicElement>
            </line>
        </band>
    </title>
    <columnHeader>
        <band height="10" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="51" height="8" uuid="34103b44-9a4b-44eb-abb4-eeb06e010968">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Left">
                    <font fontName="Arial" size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[VENCIMENTO]]></text>
            </staticText>
            <staticText>
                <reportElement x="51" y="0" width="40" height="8" uuid="d4cf8d36-1efc-4ed5-91bf-5b001e4fd612">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <box>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Right">
                    <font fontName="Arial" size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[SALDO R$]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="8" splitType="Stretch">
            <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
                <reportElement x="0" y="0" width="51" height="8" uuid="d89c64d7-e7ba-4536-9e4b-4ed6cc6cb329">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left" markup="styled">
                    <font fontName="Arial" size="6" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dataVencimento}]]></textFieldExpression>
            </textField>
            <textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
                <reportElement x="51" y="0" width="40" height="8" uuid="e4275fcb-323b-4171-a0ae-742d94eda92e">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Right">
                    <font fontName="Arial" size="6" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{valorSaldo}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <noData>
        <band height="8"/>
    </noData>
</jasperReport>

产生这种混乱的Java代码:

try{
...

            // ommited code(vars and business logic)            
            HashMap<String, Object> reportParams = new HashMap<String, Object>();
            reportParams.put("ENDERECO", endereco);
            reportParams.put("NOMEFANTASIA", nomeFantasia);         

            List<Emissao> lEmissao = new ArrayList<Emissao>();
            lEmissao.add(emissao);

            HashMap<String, Object> subParamsPBaixas = new HashMap<String, Object>();
            HashMap<String, Object> subParamsPEmitente = new HashMap<String, Object>();             

            {
                subParamsPBaixas.put("PARAMS_SUB", subParamsPEmitente);
                subParamsPBaixas.put("SUB", Resources.loadJasperReport("recibo_emissao_parcelas_emitente"));
                subParamsPBaixas.put("DADOS_SUB", emissoesPendentes);
            }
            {
                reportParams.put("PARAMS_SUB", subParamsPBaixas);
                reportParams.put("SUB", Resources.loadJasperReport("recibo_emissao_baixas"));                   
                reportParams.put("DADOS_SUB", emissao.getBaixas());
            }


            JasperPrint print = JasperFillManager.fillReport(Resources.loadJasperReport("recibo_emissao"), reportParams, new JRBeanCollectionDataSource(lEmissao));

            if (print.getPages().size() > 0){
                JasperPrintManager.printReport(print, false);               
            }
            else {
                JOptionPane.showMessageDialog(null, "O documento não possui páginas. Nenhum registro encontrado.");
            }       

        } catch (Exception e) {
            if (Services.isShowExceptions()) {
                e.printStackTrace();
            }
            ErrorHandler.showException(this, e.getLocalizedMessage(), e);
        }

我想念什么吗?这是怎么回事?请帮忙。

0 个答案:

没有答案