Jump to content
We've recently updated our Privacy Statement, available here ×

Format text field depending on database value


mpolo91

Recommended Posts

Hello everybody,

I'm using a table component to display a wide range of data. This data is catagorized by ID's and some categories should be displayed with bold text. For example the first row is Category 1 and Category 1 should be printed with bold text. The row of Category 2 than should be formatted with normal style. So there a some single rows in the table that should be printed with bold text. What is the best way to realize that? I try this bit it did not bring a change:

($F{Param1} == "1") ? "<style isBold='true'>" + $F{Param2} + "</style>" : $F{Param2}[/code]

Thanks for any hint!

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 4 weeks later...

I would check out conditional styles in Studio. You can add styles with conditions (which can be Java checks against fields such as your examples). Then, you simply set the Style property for the field you want dynamically displayed to the Style you created. More details here: https://community.jaspersoft.com/wiki/how-apply-conditional-formatting-your-text-fields

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...