2016-09-22 55 views
3

我正在Jasper Reports上工作。在我的报告中,我想要像我的数据下面的边框样式如何在页面末尾绘制一条线?

 
______ ______ ______ ______ 
|__H1__|__H2__|__H3__|__H4__| 
|  |  |  |  | 
|  |  |  |  | 
|  |  |  |  | 
|  |  |  |  | 
|______|______|______|______| 

----------Page Footer-------- 

我想获得每页最后一行的底部边框。我目前得到的是类似

 
______ ______ ______ ______ 
|__H1__|__H2__|__H3__|__H4__| 
|  |  |  |  | 
|  |  |  |  | 
|  |  |  |  | 
|  |  |  |  | 

需要有一个页脚的差距,所以我不能在页脚中使用一行。另外,如果我确实在页脚中使用了一行,报表的最后一行将没有底部边框。

有没有一种方法可以根据行作为页面的最后一行来有条件地启用Bottom边界?

screenshot of the report

回答

4

绘制线然后columnFooter带,并设置isFloatColumnFooter="true"

isFloatColumnFooter=true,呈现列脚注只是在该特定列

最后的细节或组页脚下面

<?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="Blank_A4_8" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" uuid="28bc671c-47fc-4083-8211-a3f952643349"> 
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="5 empty records"/> 
    <queryString> 
     <![CDATA[]]> 
    </queryString> 
    <columnHeader> 
     <band height="1"> 
      <line> 
       <reportElement x="0" y="0" width="300" height="1" uuid="226f98ce-bb08-4741-a5af-3073ce2aee3a"/> 
       <graphicElement> 
        <pen lineWidth="0.5"/> 
       </graphicElement> 
      </line> 
     </band> 
    </columnHeader> 
    <detail> 
     <band height="30" splitType="Stretch"> 
      <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
      <textField> 
       <reportElement x="150" y="0" width="150" height="30" uuid="5279e4bc-05ce-46d7-b4cf-ef703d105d92"> 
        <property name="com.jaspersoft.studio.unit.width" value="pixel"/> 
       </reportElement> 
       <box padding="5"> 
        <topPen lineWidth="0.0"/> 
        <leftPen lineWidth="0.5"/> 
        <rightPen lineWidth="0.5"/> 
       </box> 
       <textElement verticalAlignment="Middle"/> 
       <textFieldExpression><![CDATA["Text Field " + $V{REPORT_COUNT}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="0" y="0" width="150" height="30" uuid="96e9515f-fab2-483d-926b-6bc799199562"/> 
       <box padding="5"> 
        <topPen lineWidth="0.0"/> 
        <leftPen lineWidth="0.5"/> 
        <rightPen lineWidth="0.5"/> 
       </box> 
       <textElement verticalAlignment="Middle"/> 
       <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="1" splitType="Stretch"> 
      <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
      <line> 
       <reportElement x="0" y="0" width="300" height="1" uuid="226f98ce-bb08-4741-a5af-3073ce2aee3a"/> 
       <graphicElement> 
        <pen lineWidth="0.5"/> 
       </graphicElement> 
      </line> 
     </band> 
    </columnFooter> 
</jasperReport> 

输出(有5条空数据源上运行)

Result

注意,创建报告,发票的等,以修复 线页面上时(即不依赖于数据源)可以使用 background频带。

+0

非常感谢您的详细回复。我尝试了您的建议,并且除了最后一页以外,所有页面都能正常工作,因为列表页脚在摘要之后显示。有没有办法在最后一页不显示列页脚? –

+0

@PrakashAr在jasperReport标签上有一个属性,isSummaryNewPage =“true”,你也有isSummaryWithPageHeaderAndFooter =“false”试试这些。 –