Jump to content

Using Images filename from sql, file from c:\imag


markr74

Recommended Posts

Hi all,

 

I am trying to create a report with images on but with no success....

I have my filename stored in mysql and the actual file stored on my c: drive.

has anyone done this before???

all i seem to get is "cannot cast from string to file"

 

Thanks in advance

mark

(i am using iReport2.0.2)

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 6 months later...

Hello Mark,

 

I'm also facing the same problem. Were you able to solve your problem? I have done something similar in Crystal Reports but unable to figure out how to do this in Jasper Reports.

 

thanks & regards

 

harkiran

Post edited by: harkiransingh, at: 2008/04/29 09:10

Link to comment
Share on other sites

Hello Mike,

 

I have found the solution after scratching my head for 2-3 days. This was really simple, the option was always there but I was not able to guess which one to use in the first place. Ok, here is what I did:

 

1. created the report using iReport.

2. added an Image element onto the report

3. right click on the image element and click on properties

4. now select java.io.File in Image Expression class

5. set image expression to: new java.io.File($F{imgURL}) where $F{imgURL} is the database field which contains the physical path of the image (C:imagesabc.jpg)

6. done, thats it

 

Hope this will help many others hunting for the same solution.

 

regards

 

harkiran

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