Monday, February 24, 2014

HTML Conditional Format

Use conditional HTML Expression for formatting. 
Please follow the below step to change font fore color with HTML Expression.
Step 1 : Set Text field below property 
             Markup = "html"
Step 2 : Right click on Field to edit and write below expression. [Language:Groovy]
              Here we are using the groovy language if condition. 
              If field value is "UNBEARABLE" then print the value with color red else green.
<strong>$F{field_name}.trim() == "UNBEARABLE" ? "<font color=red>" + $F{field_name} + "</font>" : "<font color=green>" + $F{field_name} + "</font>"</strong>
 
Below is the output / result. 

tags: 
Jasper Report
Jasper Server
iReport
Date Formats