打印多个报告时,Jasper报告对齐设置不正确

时间:2015-05-06 09:21:12

标签: jasper-reports

This is the 2 printed pages

这是我的jrxml;

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.0.3.final using JasperReports Library version 5.1.0  -->
<!-- 2015-05-06T15:25: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="CWBI" pageWidth="720" pageHeight="380" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="20" uuid="e84f85df-3881-49c6-9482-eed6dbfc3f01">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="ID" class="java.math.BigDecimal"/>
    <field name="OID" class="java.lang.String"/>
    <field name="CNO" class="java.lang.String"/>
    <field name="CUST_NO" class="java.lang.String"/>
    <field name="PAYMENT" class="java.lang.String"/>
    <field name="SHIPPHONENO" class="java.lang.String"/>
    <field name="SHIPCNA" class="java.lang.String"/>
    <field name="SHIPADDR1" class="java.lang.String"/>
    <field name="SHIPADDR2" class="java.lang.String"/>
    <field name="SHIPADDR3" class="java.lang.String"/>
    <field name="SHIPADDR4" class="java.lang.String"/>
    <field name="SHIPCOUNTRYID" class="java.lang.String"/>
    <field name="SHIPPOSTALCODE" class="java.lang.String"/>
    <field name="CONCNA" class="java.lang.String"/>
    <field name="CONPHONENO" class="java.lang.String"/>
    <field name="CONADDR1" class="java.lang.String"/>
    <field name="CONADDR2" class="java.lang.String"/>
    <field name="CONADDR3" class="java.lang.String"/>
    <field name="CONADDR4" class="java.lang.String"/>
    <field name="CONCOUNTRYID" class="java.lang.String"/>
    <field name="CONPOSTALCODE" class="java.lang.String"/>
    <field name="COPIES" class="java.lang.String"/>
    <field name="ATTN" class="java.lang.String"/>
    <field name="CONTENTS" class="java.lang.String"/>
    <field name="BFLYERS" class="java.lang.String"/>
    <field name="SFLYERS" class="java.lang.String"/>
    <field name="RUSER" class="java.lang.String"/>
    <field name="RDATE" class="java.lang.String"/>
    <field name="RTIME" class="java.lang.String"/>
    <field name="REMARKS" class="java.lang.String"/>
    <field name="PSTATUS" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band/>
    </title>
    <pageHeader>
        <band height="380" splitType="Stretch">
            <textField>
                <reportElement x="32" y="27" width="79" height="18" uuid="48454381-ce78-46c8-a445-ffe05c226610">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CNO}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="108" y="27" width="79" height="18" uuid="bc98f264-765e-4dd4-b32b-3571eb12e0cb">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CUST_NO}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="185" y="27" width="59" height="18" uuid="f82b9de0-aaed-45aa-bc2a-e3d960f829b4">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <text><![CDATA[SIN]]></text>
            </staticText>
            <textField>
                <reportElement x="174" y="67" width="131" height="18" uuid="e09f0461-c93c-4efb-a7a5-e1178b882fe5">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPPHONENO}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="476" y="68" width="79" height="18" uuid="c1f28961-fe50-4c90-a9d7-9475edfa6fe9">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONPHONENO}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="300" y="88" width="262" height="18" uuid="cdb21b18-d208-421e-9841-776825e9b167">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONCNA}]]></textFieldExpression>
            </textField>
            <componentElement>
                <reportElement x="572" y="14" width="68" height="64" uuid="f5bf25f8-2967-4e4e-bfa2-7879a3275e1c"/>
                <jr:QRCode xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <jr:codeExpression><![CDATA["Customer No: " + $F{CUST_NO}]]></jr:codeExpression>
                </jr:QRCode>
            </componentElement>
            <textField>
                <reportElement x="40" y="88" width="260" height="18" uuid="74261339-33bd-4b4e-8868-424b374bcc50">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10" rightPadding="5"/>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPCNA}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="40" y="104" width="261" height="18" uuid="ace24046-246a-47ca-88ff-3e23e4a7d305">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPADDR1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="40" y="120" width="260" height="18" uuid="24669b62-c0e0-4d66-a7ea-1bf1fadf0b3a">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box topPadding="1" leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPADDR2}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="40" y="135" width="260" height="18" uuid="4f1c4de3-1e04-4c1a-9037-28a0b5293f88">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box topPadding="1" leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPADDR3}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="300" y="104" width="262" height="18" uuid="6a2a55cf-5dd0-416d-8a2d-c64d9b9090bf">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="300" y="121" width="262" height="18" uuid="bbc4faa6-a291-4852-8d01-4526fd664453">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR2}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="300" y="135" width="262" height="18" uuid="fd1b5507-5cb0-490c-8295-d6087fb12bb7">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10" rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR3}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="61" y="164" width="104" height="18" uuid="317ce82b-3ba0-4204-a304-92b988c75391">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPCOUNTRYID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="213" y="164" width="67" height="18" uuid="46b78111-0e82-45a9-86ef-2ce120b87a1e">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPPOSTALCODE}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="330" y="164" width="100" height="18" uuid="c9ca68be-593c-4bd5-9918-bf0fa51d25f1">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONCOUNTRYID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="497" y="158" width="58" height="18" uuid="950cf475-4a5a-4900-b33d-5de42950f9ed">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONPOSTALCODE}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band/>
    </columnHeader>
    <detail>
        <band/>
    </detail>
    <columnFooter>
        <band/>
    </columnFooter>
    <pageFooter>
        <band/>
    </pageFooter>
    <summary>
        <band/>
    </summary>
</jasperReport>

在这里,我在这里附上了我的两张发票。但是如果我将打印纸设置为1打印然后它将正常工作,那么如果我当时打了多于1个打印,那么它的打印就像上面的图像一样,没有正确设置到第二页,QR码图像就在里面第一页和ID行也没有像第一页那样正确设置,

我需要打印多个打印件,所有参数都应设置设计区域。 任何人都可以就这个问题提出一些建议吗?

2 个答案:

答案 0 :(得分:1)

jasper报告将支持所有指定大小的小或大。因此,您将删除详细信息区域然后尝试将所有内容放入摘要中并尝试此操作它将对您有所帮助。

同时将所有乐队保持为空白或高度较小。

答案 1 :(得分:0)

我无法对您的问题发表评论,所以我会写一个答案。 你提供的xml中没有ID号,这是完整的xml吗?底部的条形码也不见了。

以下是我的想法。您的报告似乎有点小(生成的报告小于您的报告)。你能告诉我们纸张尺寸吗? 由于报告对于您的论文来说很小,导致第二份报告打印得太早,这解释了第一页上的第二份报告。

我的ID号没有解释,因为它不在XML中。