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

Changing Color & font Dynamically


ktrinad

Recommended Posts

By: Mohan Joshi - mohanjoshi1

Changing Color & font Dynamically

2003-03-03 01:09

Hi,

 

How Can I change the color & font of a Text field Dynamically based on Value of that field ?

 

For example Say a field is displaying a amount, 1. I want to display amount in red if it is negative.

2. I want to make it bold if it is greater than say 10,000.00.

 

Is it possible to achive this ? If yes how can I do it ?

 

Thanks & Regards

Mohan

 

 

 

 

 

 

By: Giulio Toffoli - gt78

RE: Changing Color & font Dynamically

2003-03-03 01:47

There is two ways to do this.

 

1. (The simple way): create two textfield overlapped and use printWhenExpression to print only the right field (the field are equals, but the first has foreColor red, and the second black).

 

2. Use programmatically the API of jasperreports 0.4.5 or greater that permits to control by program the result of a compiled print.

 

 

I hope this helps you

 

Giulio

 

 

 

 

By: Mohan Joshi - mohanjoshi1

RE: Changing Color & font Dynamically

2003-03-03 05:53

Hi Giulio,

 

Yeh presently I am using simple way :-) but drawback is we have to difine another field, imagine if report has 20 such fields.

 

It is nice to have a this control with single text field, I am new to jasperreport, If jasper report support that, I wonder is it too difficult to impliment in iReport.

 

Just some thoughts. you might consider in future releases. Just keep in TODO list

 

-Mohan

Link to comment
Share on other sites

  • 3 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi Giulio,

Could u please explain the sencond point in detail?

"2. Use programmatically the API of jasperreports 0.4.5 or greater that permits to control by program the result of a compiled print."

I mean by using which (Any Specific Name) API it could be possible...

Thanks in advance...

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...