jonathanln Posted July 21, 2009 Share Posted July 21, 2009 Hi, I was wondering if it was possible to set a relative path to an image file which would always be in the same folder as the report.Thank you for your answer,John Link to comment Share on other sites More sharing options...
jonathanln Posted July 21, 2009 Author Share Posted July 21, 2009 Nevermind haha,Only had to erase the path till "\\blabla.gif" was left.John Link to comment Share on other sites More sharing options...
jonathanln Posted July 21, 2009 Author Share Posted July 21, 2009 Ah, it doesn't work if the image is in a custom template that you've made since the path is relative to the report and not it's template. ( my template and my report are in different folders...) If anybody knows a way, please tell me. Thank you, John Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted July 21, 2009 Share Posted July 21, 2009 There are several ways to locate an image.JasperReports tries to resolve the image position in this way:1. It checks if it can be an absolute path2. It checks if it can be a relative path of the report (if the jasper has been loaded from a file)3. It tries to load the path from the classpathThe best option: be sure the image (or the root directory if you want specify a path like "images\tests\foo\myImage.gif") is in the classpath.A last note: iReport puts in the classpath the report directory automatically.Giulio Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now