nathien Posted April 8, 2010 Share Posted April 8, 2010 Hi,I've got a problem with Images not showing up in my report.Here's what I do:I load an empty Template with the JRLoader to get a JasperReport Object.On that Object I'm calling:...JRDesignBand xBand = new JRDesignBand();...(do custom settings on the band, like drawing lines and setting JRDesignImage elements)...JasperReport xReport = JRLoader...JRBand[] Bands = xReport.getDetailSection().getBands();Bands[0] = xBand;..effectively exchanging the detail band from the already compiled report with a self generated one.This works fine, except that the Images don't show up. Other things like JRDesignStaticText and JRDesignLine show up perfectly fine though. I guess that's because the Images need to be converted to JRBaseImages to show up properly, but I didn't find a way to do just that until now.The reason that I'm loading an empty Template is because it cuts down the generation time by incredible amounts.I'm using this approach to draw a JTree structure by hand. If I compile it with a JRDesign instead of loading the template and exchanging the bands, the images show up correctly, but the generation time jumps from ~2 seconds to ~5 minutes which is unacceptable.Any help as to why the Images don't show up using my approach is greatly appreciated.Thanks,Nathien Link to comment Share on other sites More sharing options...
nathien Posted April 8, 2010 Author Share Posted April 8, 2010 Ok, I figured out how to get a JRBaseImage from my DesignImages, but since I can't add a JRBaseImage to a JRDesignBand the problem still persists. (Plus I don't even know if that's the real cause of the problem, since other Objects show up fine, except for Images). To rephrase my initial question: What do I need to do, using my approach, to get the Images to show up like the JRDesignStaticTexts and JRDesignLines? Link to comment Share on other sites More sharing options...
nathien Posted April 8, 2010 Author Share Posted April 8, 2010 Sorry for replying yet again, I still have no clue as to why the Images don't show, while Text and Lines obviously work. In the meantime I managed to convert my JRDesignBand to a JRBaseBand along with the JRDesignImage/Line/StaticText to JRBaseImage/Line/StaticText by subclassing JRBaseObjectFactory and overriding the method getBand(JRBand band). Using this Band instead of the DesignBand was to no avail as well though. I'm running out of ideas to get this to work. Any suggestions are welcome. Link to comment Share on other sites More sharing options...
nathien Posted April 9, 2010 Author Share Posted April 9, 2010 Meanwhile I changed my strategy. Instead of compiling each line of the tree strucure itself I add new detail bands to the section and only compile it once at the end. The performance is quite acceptable this way, however I'm still interested in why my first approach didn't work. If any of you got insight on what's different with images and what would have been needed to be done.. It's still appreciated. Link to comment Share on other sites More sharing options...
lucianc Posted April 26, 2010 Share Posted April 26, 2010 An image contains expressions, and in order for expressions to work at fill time they need to go through compilation. Other changes that do not involve expressions would work on a compiled report.Regards,Lucian Link to comment Share on other sites More sharing options...
elainetmy Posted July 29, 2013 Share Posted July 29, 2013 Hi Lucian, I'm currently using JasperDesign to create a dynamic report. I'm facing problem when want to create an image in header band. I'm using JRDesignImage to create the image. But when i compile the report, I debugged, I noticed the image converted into JRBaseImage. May I know what's wrong with my logic? Thanks. Elaine 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