0
如何將jasperReport導出到pptx?將Jasperreports導出到Servlet的pptx
我嘗試這一點,但不工作...
該servlet返回一個PPTX文件,但
JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, parametros, new JREmptyDataSource());
String fileName = "informeDemo.pptx";
JRPptxExporter exporter = new JRPptxExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, fileName);
exporter.exportReport();
File f = new File(fileName);
response.setContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation"); //Tipo de fichero.
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\""); //Configurar cabecera http
InputStream in = new FileInputStream(f);
out = response.getOutputStream();
int bit = 256;
while ((bit) >= 0) {
bit = in.read();
out.write(bit);
}
out.flush();
out.close();
in.close();