glassner Posted July 8, 2010 Share Posted July 8, 2010 I am trying to use the JRPptxExporter from version 3.7.3Could anyone provide any examples on how to use it and what parameter, if any, should be set ?Thank you ! Link to comment Share on other sites More sharing options...
glassner Posted July 8, 2010 Author Share Posted July 8, 2010 This is my code to generate a PdF file, where reportStream is an object of type InputStream representing the .jasper file.I could not find a way to use JasperPrint with JRPptxExporter ...JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, parameterMap, resultSet); byte[] reportBytes = JasperExportManager.exportReportToPdf(jasperPrint); //Prepare response response.setContentType("application/pdf"); response.setHeader("Content-disposition", "attachment; filename=Report.pdf" ); response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); response.setContentLength(reportBytes.length); //Send Content to Browser response.getOutputStream().write(reportBytes); response.getOutputStream().flush(); Link to comment Share on other sites More sharing options...
glassner Posted July 8, 2010 Author Share Posted July 8, 2010 Got it.This works for me. Hope somebody finds this useful JRPptxExporter pptExporter = new JRPptxExporter(); pptExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); pptExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, pptReport ); pptExporter.exportReport(); byte[] reportBytes = pptReport.toByteArray(); //Prepare response response.setContentType("application/vnd.ms-powerpoint"); response.setHeader("Content-disposition", "attachment; filename=Report.ppt" ); response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); response.setContentLength(reportBytes.length); //Send Content to Browser response.getOutputStream().write(reportBytes); response.getOutputStream().flush(); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now