Jump to content

Change an Image dynamically with Ireport?


Recommended Posts

By: Christopher lebuso - abcl246

Change an Image dynamically with Ireport?

2003-05-07 23:12

Is it possible to change an image file dynamically or do i have to create 2 (two) identicall reports with diferrent images ?

 

 

By: Giulio Toffoli - gt78

RE: Change an Image dynamically with Ireport?

2003-05-08 07:14

The image expression is not "the name of the file" but an Expression. If you set the expression to foo.gif, this is static, but ...

 

$V{mygif}

$P{mygif}

$F{mygif}

"c:\images\"+$P{ProductId}+".jpg"

...

 

are all valid image expressions.

Plese note that iReport can't evaluate an expression to show the right image in designer (you'll see a special image instead), but you'll see it a run time.

 

Giulio

Link to comment
Share on other sites

  • 9 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Might I add you could define a variable as an image URL location that you can use as a parameter to the URL class. in Ireports you can then use the variable to input the image expression as

new URL($F{imgvar}.toString()) remember to set the Exp. class to java.net.URL

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