2015-10-05 33 views
6

我正在创建显示某些人名的碧玉报告。我需要显示底部列表中的人数。即使在将“浮动列脚”设置为true后,详细信息和列脚注区域之间的差距

我面临的问题是我在人员名单和“总人选”标签之间出现小差距。

对于参考,请检查下面的图片:
Gap marked in red box

在开始的时候,列脚注渐渐显示在页面的末尾,留下了不少的差距。然后我发现几个不错的StackOverflow链接:

1)Issue with Column footer and Summary bands
2)Jasper Reports - how to get column footer to appear directly below details band

这表明设置 “浮动栏页脚” 为真。这样做之后,差距缩小了,我的专栏页脚几乎低于细节带。但是,如图所示,仍然存在一些差距,我不知道如何去除。

编辑:这是我的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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" uuid="b7718df8-d1d7-46e7-9a66-7d3fe24c720c"> 
    <parameter name="ReportName" class="java.lang.String"/> 
    <queryString> 
     <![CDATA[]]> 
    </queryString> 
    <field name="firstName" class="java.lang.String"> 
     <fieldDescription><![CDATA[firstName]]></fieldDescription> 
    </field> 
    <field name="id" class="java.lang.String"> 
     <fieldDescription><![CDATA[id]]></fieldDescription> 
    </field> 
    <field name="lastName" class="java.lang.String"> 
     <fieldDescription><![CDATA[lastName]]></fieldDescription> 
    </field> 
    <field name="middleName" class="java.lang.String"> 
     <fieldDescription><![CDATA[middleName]]></fieldDescription> 
    </field> 
    <title> 
     <band height="42" splitType="Stretch"> 
      <textField> 
       <reportElement x="0" y="0" width="555" height="42" uuid="b6eaae95-75f5-4b33-978b-8afd7f9ecfee"/> 
       <textElement textAlignment="Center" verticalAlignment="Middle"> 
        <font size="20"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression> 
      </textField> 
     </band> 
    </title> 
    <columnHeader> 
     <band height="20" splitType="Stretch"> 
      <staticText> 
       <reportElement x="0" y="0" width="32" height="20" uuid="3dfe1b88-b77c-465e-bc1d-d96223c69692"/> 
       <text><![CDATA[Sr. No.]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="32" y="0" width="188" height="20" uuid="96add808-7f90-405d-93fc-ae64596df9e3"/> 
       <textElement textAlignment="Center"/> 
       <text><![CDATA[First Name]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="220" y="0" width="188" height="20" uuid="dd5aa422-a23c-4a4c-a464-9e927503c342"/> 
       <textElement textAlignment="Center"/> 
       <text><![CDATA[Middle Name]]></text> 
      </staticText> 
      <staticText> 
       <reportElement x="408" y="0" width="147" height="20" uuid="e7894574-4f95-4a04-b54b-16f636dc453c"/> 
       <textElement textAlignment="Center"/> 
       <text><![CDATA[Last Name]]></text> 
      </staticText> 
     </band> 
    </columnHeader> 
    <detail> 
     <band height="20" splitType="Stretch"> 
      <textField> 
       <reportElement x="0" y="0" width="32" height="20" uuid="b0a9a50f-f275-4802-ba80-04559e57c75e"/> 
       <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="32" y="0" width="188" height="20" uuid="4ea4f73b-06bb-4553-848b-eecdc6be51b2"/> 
       <textElement textAlignment="Center"/> 
       <textFieldExpression><![CDATA[$F{firstName}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="220" y="0" width="188" height="20" uuid="d2ea4610-7ee7-4921-babe-6d9040592843"/> 
       <textElement textAlignment="Center"/> 
       <textFieldExpression><![CDATA[$F{middleName}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="408" y="0" width="147" height="20" uuid="045272ac-1387-49c6-a4e1-237725e08269"/> 
       <textElement textAlignment="Center"/> 
       <textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="20" splitType="Stretch"> 
      <staticText> 
       <reportElement x="0" y="0" width="79" height="20" uuid="5a71d074-89c3-4b70-ae90-840cb37b45e8"/> 
       <text><![CDATA[Total Candidates:]]></text> 
      </staticText> 
     </band> 
    </columnFooter> 
    <pageFooter> 
     <band height="54" splitType="Stretch"/> 
    </pageFooter> 
    <summary> 
     <band height="42" splitType="Stretch"/> 
    </summary> 
</jasperReport> 

任何建议将非常感激!

+0

也许你有一些空的组页脚,很难说没有看到jrxml ......,你也可以考虑使用组页脚,并把你的总体选择卡在那里。 –

+0

@PetterFriberg我会尝试使用组页脚。感谢Petter的建议。 –

+0

//是你的答案在这里:http://stackoverflow.com/questions/12377178/issue-with-column-footer-and-summary-bands –

回答

5
<summary> 
    <band height="0" splitType="Stretch"/> 
</summary> 

或完全删除标签。