Can we print only a certain page in a multi page jasper report?
Is there a way to print only specific pages in jasper. I need it for pagination purpose.
ex: if I have 20 pages, i should be able to get jasper to generate one page report at a time. Can i pass the page numbe开发者_如何学JAVAr as a param?
Answering my own question,
Yes it is possible.. atleast in case of HTML and csv reports. The code that does this is below.
JRHtmlExporter exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(3));
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"d://ReportResult//FinalReportResult.html");
Once this is set, just do a
exporter.exportReport();
In the above case, page number 4, i.e, index 3 is exported to the HTML file.
精彩评论