gpt4 book ai didi

jasper-reports - 如何在页面末尾画一条线?

转载 作者:行者123 更新时间:2023-12-04 08:25:17 25 4
gpt4 key购买 nike

我正在研究 Jasper Reports。在我的报告中,我希望我的数据具有如下所示的边框样式

 ______ ______ ______ ______|__H1__|__H2__|__H3__|__H4__|  |      |      |      |      ||      |      |      |      | |      |      |      |      ||      |      |      |      | |______|______|______|______|----------Page Footer--------

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

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

页脚需要有一个空隙,所以我不能在页脚中使用一行。此外,如果我确实在页脚中使用了一行,则报告的最后一行将没有底部边框。

有没有办法根据页面的最后一行有条件地启用底部边框?

screenshot of the report

最佳答案

然后画线 columnFooter Band 并设置 isFloatColumnFooter="true"

isFloatColumnFooter=true, render column footer just below the last detail or group footer on that particular column

示例

<?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

Note, when creating reports as invoice's etc, with fix lines on page (that does not depend on datasource) the background band can be used.

关于jasper-reports - 如何在页面末尾画一条线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39641339/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com