2016-09-22 17 views
0

我在Jasper iReport中創建了一個報告。但是,如果我想要的話,字段的對齊方式不合適。如何對齊列腳註中的所有字段?

我在Detail band中添加了日期和短信計數,並且總信息數量爲Column band。當我有detail band總計短信數,然後它迭代並顯示多個時間。

短信盤點報告圖片:

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> 

+1

想想接受最好的答案(綠色檢查旁邊回答你先知),看到[接受回答](http://stackoverflow.com/help/accepted-answer) –

回答

2

激活在報告屬性 「浮動列腳註」。

Ireport Screenshot

+0

@AtulRai:很高興幫助。如果您認爲我的回答最有幫助,請[標記爲已接受](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)供他人查看。 – tobi6

0

你用什麼iReport的版本? 嘗試將「總計短信數量」作爲頁腳添加到另一個頁腳級別。