private void cargarPropiedadesReporte(JRXlsExporter exporter) { SimpleXlsReportConfiguration configuracionExcel = new SimpleXlsReportConfiguration(); configuracionExcel.setDetectCellType(Boolean.TRUE); configuracionExcel.setOnePagePerSheet(Boolean.FALSE); configuracionExcel.setWhitePageBackground(Boolean.FALSE); configuracionExcel.setRemoveEmptySpaceBetweenColumns(Boolean.TRUE); configuracionExcel.setRemoveEmptySpaceBetweenRows(Boolean.TRUE); configuracionExcel.setIgnoreCellBorder(Boolean.FALSE); exporter.setConfiguration(configuracionExcel); }
public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/JRMDbReport.jrprint"); JasperPrint jasperPrint = (JasperPrint) JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls"); JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File(TMP_DIR + ALL_CHARTS_REPORT_JRPRINT); Map<String, String> dateFormats = new HashMap<String, String>(); dateFormats.put("EEE, MMM d, yyyy", "ddd, mmm d, yyyy"); JasperPrint jasperPrint = (JasperPrint) JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls"); JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(true); configuration.setDetectCellType(true); configuration.setFormatPatternsMap(dateFormats); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }