如何对齐列页脚中的总字段?

时间:2016-09-22 11:38:08

标签: jasper-reports

我在Jasper iReport中创建了一个报告。但是字段的排列并不合适。

我在Detail band中添加了日期和短信计数,在Column band中添加了总短信计数。当我在detail band中有总sms计数时,它会迭代并显示多个时间。

短信计数报告图片:

Sms Count Report Image

XML代码是......

  <?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="smsCount" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
    <defaultValueExpression><![CDATA["C:\\Users\\NIC\\Desktop\\report\\"]]></defaultValueExpression>
</parameter>
<parameter name="fromDate" class="java.util.Date"/>
<parameter name="toDate" class="java.util.Date"/>
<queryString>
    <![CDATA[select (select sum(sent_count) from IMMIGRATION.OVERSTAY_SENT_SMS_COUNT  where sent_date between $P{fromDate} and $P{toDate}) totalCount,to_char(sent_date,'dd-mm-yyyy') sent_date,sent_count from IMMIGRATION.OVERSTAY_SENT_SMS_COUNT where sent_date
between $P{fromDate} and $P{toDate}]]>
</queryString>
<field name="TOTALCOUNT" class="java.math.BigDecimal"/>
<field name="SENT_DATE" class="java.lang.String"/>
<field name="SENT_COUNT" class="java.math.BigDecimal"/>
<background>
    <band splitType="Stretch"/>
</background>
<title>
    <band height="83" splitType="Stretch">
        <staticText>
            <reportElement x="122" y="21" width="420" height="48" forecolor="#FF9999"/>
            <textElement>
                <font size="30"/>
            </textElement>
            <text><![CDATA[National Informatic Center]]></text>
        </staticText>
    </band>
</title>
<pageHeader>
    <band height="35" splitType="Stretch">
        <staticText>
            <reportElement x="234" y="0" width="139" height="24"/>
            <textElement>
                <font size="14" isUnderline="true"/>
            </textElement>
            <text><![CDATA[SMS Count Reports]]></text>
        </staticText>
    </band>
</pageHeader>
<columnHeader>
    <band height="28" splitType="Stretch">
        <staticText>
            <reportElement mode="Transparent" x="61" y="0" width="100" height="20" backcolor="#CCCCCC"/>
            <textElement textAlignment="Center">
                <font size="12"/>
            </textElement>
            <text><![CDATA[Date]]></text>
        </staticText>
        <staticText>
            <reportElement x="404" y="0" width="100" height="20" backcolor="#CCCCCC"/>
            <textElement textAlignment="Center">
                <font size="12"/>
            </textElement>
            <text><![CDATA[SMS Count]]></text>
        </staticText>
    </band>
</columnHeader>
<detail>
    <band height="35" splitType="Stretch">
        <textField>
            <reportElement x="61" y="9" width="100" height="20" backcolor="#FFFFFF"/>
            <textElement textAlignment="Center"/>
            <textFieldExpression><![CDATA[$F{SENT_DATE}]]></textFieldExpression>
        </textField>
        <textField>
            <reportElement x="404" y="9" width="100" height="20"/>
            <textElement textAlignment="Center"/>
            <textFieldExpression><![CDATA[$F{SENT_COUNT}]]></textFieldExpression>
        </textField>
    </band>
</detail>
<columnFooter>
    <band height="35">
        <textField>
            <reportElement x="404" y="0" width="100" height="20"/>
            <textElement textAlignment="Center"/>
            <textFieldExpression><![CDATA[$F{TOTALCOUNT}]]></textFieldExpression>
        </textField>
        <staticText>
            <reportElement x="291" y="0" width="113" height="20"/>
            <textElement>
                <font isItalic="true"/>
            </textElement>
            <text><![CDATA[     Total SMS Count=]]></text>
        </staticText>
    </band>
</columnFooter>

2 个答案:

答案 0 :(得分:2)

激活&#34; Float列页脚&#34;在报告属性中。

Ireport Screenshot

答案 1 :(得分:0)

您使用的是什么iReport版本? 尝试将“总sms计数”放在另一个页脚级别作为页脚。