Java export multiple jasper file to multiple excel sheets

String input = “C:\\report\\Test_1.jrxml”;

String input2 = “C:\\report\\Test_2.jrxml”;

JasperReport jreport = JasperCompileManager.compileReport(input);

JasperReport jreport2 = JasperCompileManager.compileReport(input2);

JasperPrint jprint1 = JasperFillManager.fillReport(jreport, null,ds.getConnection());

JasperPrint jprint2 = JasperFillManager.fillReport(jreport2, null,ds.getConnection());

List<JasperPrint> jprintlist = new ArrayList<JasperPrint>();

jprintlist.add(jprint1);

jprintlist.add(jprint2);

JRXlsxExporter exporter = new JRXlsxExporter();

exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);

exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT_LIST, jprintlist);

String xlsFile = “D:\\test.xlsx”;

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, xlsFile);

exporter.exportReport();

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.