I have a jasper file which i export to PDF and Excel as of now i am using only one jasper i want the PDF exported report should be "isIgnorePagination=''true" and for Excel report should be "isIgnorePagination = 'false' "?
How to set from java code?
You will need to know at runtime if you are exporting to Excel or PDF, which you should know.
Just as an example:
public void generateReport(JasperPrint report, boolean isExcel, String saveTo){
JRExporter exporter = null;
if (isExcel) {
exporter = new JRXlsExporter();
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
//we set the one page per sheet parameter here
exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
} else {
exporter = new JRPdfExporter();
}
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);124
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, saveTo);
export.exportReport();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With