【问题标题】:How to add a line to the bottom of my table?如何在表格底部添加一行?
【发布时间】:2022-01-27 18:01:15
【问题描述】:

我将 Java Swing 与 JasperReports 一起使用。在 Jasper 中,我有在 Band: Details. 中的项目,我在它们周围创建了行(上、左、右)。问题在于底部的那条线。

报告布局

当我放入页脚并运行它时 - 该行不会关闭正方形。我如何才能关闭这个方块,并且与我有多少物品无关?

当前输出,预期结果

【问题讨论】:

  • 列页脚、页脚和最后一页页脚带是静态调整大小的。
  • 1.为细节带添加边框。这种方式在每个细节带上打印边框。 2.使用(虚拟)组页脚而不是页脚。这种方式仅在最后一页打印关闭边框。 3.使用背景带。
  • @YasuyukiUno 它适用于假人。谢谢! :)

标签: jasper-reports


【解决方案1】:

要在每页表格的末尾添加边框,请使用columnFooter 带并在jasperReport 标签上设置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="Example" pageWidth="595" pageHeight="842" columnWidth="500" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30"  isFloatColumnFooter="true" uuid="43c90ca5-f3c3-4dda-8423-9ff1442f90e3">
    .....
   <columnFooter>
    <band height="2">
        <line>
            <reportElement x="0" y="0" width="555" height="1" uuid="1c32f6e5-414a-428d-8b06-35cd80e8dff6"/>
        </line>
    </band>
   </columnFooter>
</jasperReport>

要在表格末尾添加边框(如果溢出则不在每个页面上)使用虚拟组和groupFooter

示例

<group name="lastBorderLine">
    <groupExpression><![CDATA["dummy"]]></groupExpression>  
    <groupFooter>
        <band height="2">
            <line>
                <reportElement x="0" y="0" width="555" height="1" uuid="3510fdc6-0f30-4ec9-8e17-ac51fd4012c1"/>
            </line>
        </band>
    </groupFooter>
</group>

【讨论】:

    【解决方案2】:

    已解决,通过添加组。 我有乐队:细节,在细节的顶部和底部有线条(关闭矩形)。然后我在 Detail Band 下添加了 Group,仅此而已

    附:我是按照@YasuyukiUno 的指示进行的

    【讨论】:

      【解决方案3】:

      您可以创建带有边框底部的样式并将其应用于表格。这会在每页的表格底部添加一行。

      【讨论】:

        猜你喜欢
        • 2022-01-12
        • 2011-11-23
        • 2020-02-09
        • 1970-01-01
        • 2018-07-29
        • 1970-01-01
        • 2020-06-05
        • 2012-04-19
        • 1970-01-01
        相关资源
        最近更新 更多