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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -