Is it possible to add a parameter after JasperPrint object is created?

This is a Jasper Reports Java API question: I am trying to add a parameter that will be accessible to the report after the JasperFillManager has created the JasperPrint object.

I want certain things conditionally printed on the report depending on the export format: PDF, XLS, etc. But the report is filled and baked on one screen, and then the user chooses the report format on another screen before the exporter exports it. I cannot see the original parameters that were put into the report before the JasperPrint object was created and can find no way to add another param.

I tried jasperPrint.setProperty(), SimpleReportContext.setParameterValue(), then put context into exporter. None of these parameters are visible in a print when expression.

Any ideas, other than get the format type at the outset from the user?

 

Many Thanks in advance.

charioteer7's picture
Joined: Oct 9 2015 - 1:16pm
Last seen: 6 years 5 months ago

1 Answer:

jasperprint is a static format and can not be change. If you have to change it, export it some other format like xlsx and filter that and use that as a datasource to regenerate jasperprint.

hozawa's picture
139155
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 2 months ago
Feedback
randomness