【发布时间】:2016-12-17 00:37:11
【问题描述】:
有没有办法在 Jasper 报告中将 textFields 动态添加到 columnFooter。
我有可能需要使用的情况:
<columnFooter>
<band height="21" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="50" height="21"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["Example text...."]]></textFieldExpression>
</textField>
</band>
或
<columnFooter>
<band height="42" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="50" height="21"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["Example text...."]]></textFieldExpression>
</textField> <textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="50" height="21"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["More example text...."]]></textFieldExpression>
</textField>
</band>
(或添加任意数量的文本字段。由于我不知道将添加多少,我需要以某种方式动态调整乐队的大小)我正在寻找一种在 Java 中动态执行此操作而不必对其进行硬编码的方法在 jrxml 文件中。谢谢
【问题讨论】:
-
您可以使用(JasperReports API)[jasperreports.sourceforge.net/api/] 或DynamicJasper API,例如
-
第一个链接似乎已失效,您能否指出使我能够执行此操作的 DynamicJasper API 的具体内容?也许是一个代码示例。
标签: java jasper-reports