jasper-reports - 如何根据条件创建不同的页脚?
问题描述
我需要根据条件显示不同的页脚。
我的页脚由许多静态标签组成,理论上我可以为每个标签定义一个“当表达式时打印”。但这很不方便。
问:是否可以根据条件选择不同的页脚?
如果不是,我还能如何处理这种情况而不必在很多地方指定条件?
解决方案
xsd允许没有或最多一个 pageFooter
标签,最多一个波段。
但
这是一个典型示例,您可以使用框架组件对数据进行分组并决定是否显示它。
根据页码显示带有文本字段的不同框架的示例
<pageFooter>
<band height="60" splitType="Stretch">
<frame>
<reportElement x="0" y="0" width="540" height="60" uuid="d0198e94-8325-4909-9804-a8d393600ec5">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}%2!=0]]></printWhenExpression>
</reportElement>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="379e2ac0-63ea-4493-bd38-1b7ca7b35d8c"/>
<textFieldExpression><![CDATA["Text Field 1"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="30" width="100" height="30" uuid="6598ba79-08b6-4997-953d-70b64f159e3b"/>
<textFieldExpression><![CDATA["Text Field 2"]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="0" y="0" width="540" height="60" uuid="d0198e94-8325-4909-9804-a8d393600ec5">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER}%2==0]]></printWhenExpression>
</reportElement>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="379e2ac0-63ea-4493-bd38-1b7ca7b35d8c"/>
<textFieldExpression><![CDATA["Text Field 3"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="30" width="100" height="30" uuid="6598ba79-08b6-4997-953d-70b64f159e3b"/>
<textFieldExpression><![CDATA["Text Field 4"]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
将不同pageFooter的不同文本添加到不同的frame中,然后在frame组件上设置printWhenExpression。
推荐阅读
- node.js - NodeJS:异步等待的产品颜色模型问题
- rust - 我的网络之外的主机响应我的 SYN 数据包
- laravel - 如何将集合合并到laravel中的特定列中
- filter - 按标签过滤邮件线程数组
- python - 如何渲染一个拾取和放置机器人环境 pn gym OpenAI
- reactjs - 过滤来自 api 的响应的数据
- powerbi - 从第一次出现的值创建列计数
- http - ServeHTTP 的 http.ResponseWriter 接口中传递了什么原始类型?
- flutter - 如何停止:Flutter Console 打印 [ZeroHung]zrhung_get_config: Get config failed for wp[0x0102] in debug mode?
- mysql - 我有 sql 表名站 i,我有列名 id,city