JasperReports的交替行颜色 [英] Alternating row color for JasperReports
本文介绍了JasperReports的交替行颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为JasperReports子报表中的行提供交替颜色。我有所有行具有相同的背景颜色,但我想要交替。可以这样做吗?
I want to get color to alternate for the rows in a JasperReports subreport. I have all rows with the same background color but I want it to alternate. Can this be done?
推荐答案
是的,您可以在JRXML文件内设置样式,如下所示:
Yes you can set up a style inside the JRXML file like this:
<style name="Zebra" mode="Transparent">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 1]]></conditionExpression>
<style backcolor="#CAC5BB"/>
</conditionalStyle>
</style>
并将其添加到您的报表元素,如下所示:
and add it to your report elements like this:
<reportElement style="Zebra" mode="Opaque" x="1" y="1" width="554" height="20"/>
不能向样式模板文件添加条件样式(例如 .jrtx
文件)。
You cannot add conditional styles to style template files (e.g., .jrtx
files).
这篇关于JasperReports的交替行颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文