Creating new instances of JasperDesign or JasperReport

0

Hi!

I have a report which has different sized images. I need to show and reposition this image individually according to their dimension which means that the x,y, width and height of every image will be different.

The first solution came to my mind was dynamically changing the position of the JRDesignImage in the JasperDesign(can be JasperReport obhect as well) object.

The problem is if I set the dimensions of the JRDesignImage element, then that configuration overrides the other element positions as I only have one JrDesignElement for every image. 

Then, I thought that I could create sub reports for every image . Actually this solution is working but every time I need to do an IO operation, create the design or report by file path.

Is there any possibilty for me to load the design once and create new instances of that dynamically ? 

After reading the source code, I figured out that I can do smtg like this : 

JasperDesign design = JRXmlLoader.load("filePath");
JRBaseReport jrBaseReport = new JRBaseReport(design).

but I can not use JRBaseReport while filling the report. Is there any way that I can do that for JasperDesign or JasperReport objects? () I want to create a singleton JasperDesign object and at runtime I want to create 

new instances of that basically..

Or maybe you have another solution for me that I dont need to do this ineffective solution..

Kind regards

pierrehakan's picture
Joined: Jul 26 2017 - 10:00am
Last seen: 1 year 1 month ago

0 Answers:

No answers yet
Feedback
randomness