通过iReport格式化Jasper报告的布局,以消除波段之间的空间

时间:2013-02-25 15:14:47

标签: jasper-reports ireport

我有以下报告,使用iReport 3.0开发(由于系统限制,我们必须使用此版本)。但无论我做什么,我都无法摆脱页眉(地址)和列标题之间的空白区域。

JRXML:

<?xml version="1.0" encoding="UTF-8"?>
<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="customisation_summary" pageWidth="595" pageHeight="700" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true">
    <style name="alternateStyle" isDefault="false" backcolor="#FFFFFF" fontName="Arial">
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue() % 2 == 0)]]></conditionExpression>
            <style isDefault="false" style="alternateStyle" backcolor="#F7F7F7"/>
        </conditionalStyle>
    </style>
    <parameter name="orderId" class="java.lang.String">
        <defaultValueExpression><![CDATA[new Integer(0).toString()]]></defaultValueExpression>
    </parameter>
    <parameter name="REPORT_IMG_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["C:\\kukri\\workspaces\\sts_3_0_0\\clubshop\\clubshop\\src\\main\\webapp\\jasper\\images\\"]]></defaultValueExpression>
    </parameter>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["C:\\kukri\\workspaces\\sts_3_0_0\\clubshop\\clubshop\\src\\main\\webapp\\jasper\\"]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[SELECT so.customer_id, so.order_date, so.order_ref, p.product_code, p.colour_code, p.name, SUM(soi.quantity) AS quantity, sz.size, '-' AS uom, '-' AS location, scc.unit_charge, SUM(soi.quantity * scc.unit_charge) total_charge

                         FROM sales_order AS so, sales_order_item AS soi, product AS p, stock AS st, size AS sz, stock_currency_charge AS scc

                         WHERE so.id = soi.order_id 
                         AND soi.stock_id = st.id
                         AND st.product_id = p.id
                         AND st.id = scc.stock_id
                         AND st.size_id = sz.id
                         AND so.currency = scc.currency_code
                         AND so.id = '$P!{orderId}'

                         GROUP BY st.id

                         ORDER BY p.name, sz.display_seq]]>
    </queryString>
    <field name="customer_id" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="order_date" class="java.sql.Timestamp">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="order_ref" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="product_code" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="colour_code" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="name" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="quantity" class="java.lang.Integer">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="size" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="uom" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="location" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="unit_charge" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="total_charge" class="java.math.BigDecimal">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <title>
        <band height="72" isSplitAllowed="false">
            <image onErrorType="Icon">
                <reportElement key="image-4" x="-1" y="0" width="555" height="71"/>
                <imageExpression class="java.lang.String"><![CDATA[$P{REPORT_IMG_DIR} + "//Top_Image.png"]]></imageExpression>
            </image>
            <staticText>
                <reportElement x="307" y="51" width="247" height="20"/>
                <textElement textAlignment="Right">
                    <font size="14"/>
                </textElement>
                <text><![CDATA[Order Customisation Pick Sheet]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="45">
            <staticText>
                <reportElement x="399" y="2" width="62" height="18"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Order Ref: ]]></text>
            </staticText>
            <textField>
                <reportElement x="464" y="20" width="92" height="20"/>
                <textElement textAlignment="Right" verticalAlignment="Middle"/>
                <textFieldExpression class="java.util.Date"><![CDATA[$F{order_date}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="464" y="1" width="93" height="20"/>
                <textElement textAlignment="Right" verticalAlignment="Middle"/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{order_ref}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="399" y="20" width="62" height="20"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Order Date: ]]></text>
            </staticText>
            <subreport>
                <reportElement x="179" y="1" width="175" height="40"/>
                <subreportParameter name="customer_id">
                    <subreportParameterExpression><![CDATA[$F{customer_id}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customisation_jobsheet_summary_invaddy.jasper"]]></subreportExpression>
            </subreport>
            <subreport>
                <reportElement x="0" y="0" width="175" height="40"/>
                <subreportParameter name="customer_id">
                    <subreportParameterExpression><![CDATA[$F{customer_id}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customisation_jobsheet_summary_del_addy.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="20">
            <staticText>
                <reportElement mode="Opaque" x="23" y="1" width="79" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[Product Code]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="463" y="1" width="39" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[UOM]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="178" y="1" width="231" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[Product ]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="102" y="1" width="76" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[Colour]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="409" y="1" width="26" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[Size]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="435" y="1" width="28" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[QTY]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="501" y="1" width="55" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[Location]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="2" y="1" width="21" height="18" backcolor="#CCCCCC"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="8" isBold="true"/>
                </textElement>
                <text><![CDATA[#]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="19">
            <textField>
                <reportElement style="alternateStyle" isPrintRepeatedValues="false" x="21" y="1" width="79" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{product_code}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="alternateStyle" isPrintRepeatedValues="false" x="176" y="1" width="231" height="18"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="alternateStyle" isPrintRepeatedValues="false" x="100" y="1" width="76" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{colour_code}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="alternateStyle" x="433" y="1" width="28" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.Integer"><![CDATA[$F{quantity}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="alternateStyle" x="461" y="1" width="39" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{uom}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="alternateStyle" x="499" y="1" width="55" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{location}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="0" y="1" width="21" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="alternateStyle" x="407" y="1" width="26" height="18"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{size}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="50"/>
    </columnFooter>
    <summary>
        <band height="80"/>
    </summary>
</jasperReport>

0 个答案:

没有答案