打印多个报告时,Jasper报告对齐设置不正确 [英] Jasper report alignment not setting properly when printing more than one report

查看:191
本文介绍了打印多个报告时,Jasper报告对齐设置不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的jrxml;

Here is my 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行也没有像第一页那样正确设置,

Here, I have attached my two invoices here. but If I set the printer paper for 1 print then it will be working properly , then If I put more than 1 print at the time then its printing like the above image, not set properly to the second page the QR code image is inside the first page and the ID line also not properly set like 1st page,

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

I need to print more than 1 print at the time and all the parameters should set the designed area. Can anyone suggest some tips for this issue?

推荐答案

jasper报告将支持所有人的小或大指定大小所以,你将删除详细信息带,然后尝试将你的所有内容放在摘要中并试试这对你有帮助。

It is small or big the jasper report will support to all specified sizes So, you will remove the details band then try to putting your all inside the summary and try this it will help to you.

同时保持所有乐队成为一个空白或身高较小。

Also keep all the band as a blank or with small height.

这篇关于打印多个报告时,Jasper报告对齐设置不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆