1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/base?user=root");
String fichier = "C://exemple.jasper";
Map parameters = new HashMap();
parameters.put("p", 1);
JasperPrint jasperPrint = JasperFillManager.fillReport(fichier, parameters, con);
JRXlsExporter exporterXLS = new JRXlsExporter();
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);
exporterXLS.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C://exemple.xls" );
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
exporterXLS.exportReport(); |
Partager