java - How to specify different background colors for alternative rows programatically with JasperReports API -
i creating jasperreports xls report java code (without using .jrxml).
i need set different background colors alternative rows in detail section.
how can it?
use style-definition @ beginning of report:
<style name="datacellstyle" mode="opaque" border="none"> <conditionalstyle> <conditionexpression> <![cdata[new boolean($v{report_count}.intvalue() % 2 == 0)]]> </conditionexpression> <style mode="opaque" backcolor="#e0e0e0" /> </conditionalstyle> </style>
...and use style data-cells:
<detail> <band height="15"> <textfield> <reportelement x="0" y="0" width="150" height="15" style="datacellstyle"/> <textfieldexpression class="java.lang.string"> <!-- --> </textfieldexpression> </textfield> </band> </detail>
more info conditional styles here
Comments
Post a Comment