Background: Jaspersoft studio 6.2
How to change forecolor of a text field based on an expression.
How can I apply a expression so the font color (forecolor) will be based on the value in that field? I can't find anywhere to set a expression for the forecolor property.
Maybe there is an option:
You need to set markup
to style
.
And then use an expression in the text field:
F{value1}=="GREEN"?$F{value1}:"<style backcolor='red'>"+$F{value1}+"</style>"
You can also add conditions and set multiple colors:
F{value1}=="GREEN"?"<style backcolor='green'>"+$F{value1}+"</style>":"<style backcolor='red'>"+$F{value1}+"</style>"
Maybe this will work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With