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

Create New Image Element options


beekerc69

Recommended Posts

Can someone explain the difference in the 5 options you get when you create a new image element in JasperSoft Stuido

cie.png.1e1157e23802ea25c2150f39555a2bb8.png

And most specifically, can someone provide examples of how to use the "Custom Expression".

is the expression used to create the path and name of the image file?  (dynamic selection)

Or

is the expression used (like a Case statment) to select from a set of hard coded image files (resources)?

Examples would be great

Thanks in advance

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I don't actually know, but here's the JasperReports reference on images:

http://jasperreports.sourceforge.net/sample.reference/images/index.html

By default an expression is Java. (You can also set it to Groovy or JavaScript) I'm guessing you can do anything in that Java, as long as you return one of the listed  legal return types.

Image Expression 

The value returned by the image expression is the source for the image to be displayed. The image expression is introduced by the <imageExpression/> element and can return values from only the limited range of classes listed following:java.lang.String

  • java.io.File
  • java.net.URL
  • java.io.InputStream
  • java.awt.Image
  • net.sf.jasperreports.engine.JRRenderable
Link to comment
Share on other sites

CustomExpression is used to retrieve image dynamically. For example, it image file name is in the database, put the field name here to get a different image for each row - example: product images in a list.

 

Workplace is just a folder within your Jaspersoft Studio workspace. Absolute Path is a absolute path (e.g. C:imagesjasperlogo.png), URL is to retrieve image on the web (just enter the uri of the image you can access from the web browser, No Image is to just put an Image component without specifying any image yet - needs to set image before generating report.

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