How can I use a conditional TextField in JasperReports?(如何在 JasperReports 中使用条件 TextField?)
问题描述
我想要一对取决于值的 TextField.并且y"值应根据空白进行调整.
I would like to have a pair of TextFields depending on a value. And the "y"-value should be adjusted depending on the empty space.
当值为 "0"
我想隐藏 TextField.
When the value is "0"
I would like to hide the TextField.
即我想隐藏 staticText
和 textField
如果参数 red
等于 "0"
并且有蓝色值向上移动,在下面的 jrxml 代码中:
I.e. I would like to hide the staticText
and the textField
if the parameter red
is equal to "0"
and have the blue values moved up, in the jrxml-code below:
<staticText>
<reportElement x="100" y="30" width="100" height="30"/>
<text><![CDATA[Red items:]]></text>
</staticText>
<textField>
<reportElement x="200" y="30" width="40" height="30"/>
<textFieldExpression>
<![CDATA[$P{red}]]>
</textFieldExpression>
</textField>
<staticText>
<reportElement x="100" y="60" width="100" height="30"/>
<text><![CDATA[Blue items:]]></text>
</staticText>
<textField>
<reportElement x="200" y="60" width="40" height="30"/>
<textFieldExpression>
<![CDATA[$P{blue}]]>
</textFieldExpression>
</textField>
输出示例:
//if blue = 3 and red = 2 if blue = 3 and red = 0 if blue = 0 and red = 2
Red items: 2 Blue items: 3 Red items: 2
Blue items: 3
这些文本字段将放置在我的报告的末尾.我该怎么做?
These TextFields will be placed at the end of my report. How can I do this?
推荐答案
<reportElement ...>
<printWhenExpression><![CDATA[$P{red} == 0]]></printWhenExpression>
</reportElement>
您可以使用 iReport 以令人愉悦的 UI 对其进行修改.
You can use iReport to modify this with a pleasant UI.
这篇关于如何在 JasperReports 中使用条件 TextField?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 JasperReports 中使用条件 TextField?


- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01