How to change color ( style ) of the field


I can change Color of the field by inserting conditional style.

My question is if my field value is with AB-CD

i need to split AB and CD and change AB with one color and CD with another color

i can able to split value but i could'nt able to change the style

is there is any method to todo?

Thanks in Advance

imrohithsnair's picture
Joined: Jan 30 2019 - 11:45pm
Last seen: 3 weeks 4 days ago

1 Answer:



You could try some html markup with a replace to target specific text.

  1. Set  <textElement markup="html"/> of your textField
  2. Right click your textField and edit expression set syntax as $F{WORDS_SAMPLE}.replace( "go", "<i>"+"go"+"</i>" )

I imagine you can insert styling into the field value like you can with italic html tags.

$F{WORDS_SAMPLE}.replace( "<style forecolor='red'>", "<i>"+"go"+"</style>" )'s picture
Joined: Aug 29 2018 - 11:12am
Last seen: 13 hours 2 min ago