JRExporter exporter = null; exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); exporter.exportReport();
List jpList = new ArrayList(); jpList.add(JRLoader.loadObjectFromFile("build/reports/Report1.jrprint")); ... JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, jpList); exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, stream); exporter.exportReport();
protected ReportWriter(final JasperPrint _jasperPrint, final JRExporter _exporter) { jasperPrint = _jasperPrint; exporter = _exporter; exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); }
protected ReportWriter(final JasperPrint _jasperPrint, final JRExporter _exporter) { jasperPrint = _jasperPrint; exporter = _exporter; exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); }
JRExporter exporter = new JRExporter(); ByteArrayOutputStream os=new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os); exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS,Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "inline;filename=" + "one.xls"); response.getOutputStream().write(os.toByteArray());
public JRExporter getExporter(final String _format) { checkFormat(_format); final JRExporter exporter = FORMAT_INFO.get(_format).getExporterInstance(); //FIXME migrate to Exporter exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); return exporter; }
private static void setupParameters(HttpServletRequest request, String imageServletUrl, JasperPrint jasperPrint, Map imagesMap, JRExporter exporter) { exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, request.getContextPath() + "/" + imageServletUrl + "?image="); // Needed to support chart images: exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); HttpSession session = request.getSession(); session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint); session.setAttribute("net.sf.jasperreports.j2ee.jasper_print", jasperPrint); }
public JRExporter getExporter(final String _format) { checkFormat(_format); final JRExporter exporter = FORMAT_INFO.get(_format).getExporterInstance(); //FIXME migrate to Exporter exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); return exporter; }
@Override public InputStream write() throws IOException, JRException { LOGGER.info("entering FileReportWriter.writeTo()"); final File file = File.createTempFile("djreport", ".tmp"); file.deleteOnExit(); exporter.setParameter(JRExporterParameter.OUTPUT_FILE, file); exporter.exportReport(); return new FileInputStream(file); }
@Override public InputStream write() throws IOException, JRException { LOGGER.info("entering MemoryReportWriter.write()"); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); exporter.exportReport(); return new ByteArrayInputStream(stream.toByteArray()); } }
List<JasperPrint> jprintlist = new ArrayList<JasperPrint>(); jprintlist.add(jprint1); jprintlist.add(jprint2); JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, jprintlist);
File myJasperFile // reference to compiled Jasper file JRExporter exp = new JRPdfExporter() ByteArrayOutputSream b; JasperPrint p = JasperFillManager.fillReport(...) exp.setParameter(JRExporterParameter.OUTPUT_STREAM, b) exp.setParameter(JRExporterParameter.JASPER_PRINT, p) exp.exportReport() // b now contains the PDF binary
@Override public InputStream write() throws IOException, JRException { LOGGER.info("entering MemoryReportWriter.write()"); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); exporter.exportReport(); return new ByteArrayInputStream(stream.toByteArray()); } }
@Override public InputStream write() throws IOException, JRException { LOGGER.info("entering FileReportWriter.writeTo()"); final File file = File.createTempFile("djreport", ".tmp"); file.deleteOnExit(); exporter.setParameter(JRExporterParameter.OUTPUT_FILE, file); exporter.exportReport(); return new FileInputStream(file); }
private File exportReportPDF(JasperPrint jp, File file) throws JRException, FileNotFoundException { JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp); exporter.setParameter(JRExporterParameter.OUTPUT_FILE, file); exporter.exportReport(); return file; }
JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, new FileOutputStream("c:/mipdf.pdf")); //The following is the important line exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, Arrays.asList(jasperPrint, jasperPrint)); exporter.exportReport();
JasperReport ordersReport = JasperCompileManager.compileReport(srcOrdersReport); JasperPrint jpOrdersReport = JasperFillManager.fillReport(ordersReport, ordersParamsMap, ordersDataSource); JasperReport receiptsReport = JasperCompileManager.compileReport(srcReceiptsReport); JasperPrint jpReceiptsReport = JasperFillManager.fillReport(receiptsReport, receiptsParamsMap, receiptsDataSource); JasperReport invoicesReport = JasperCompileManager.compileReport(srcInvoicesReport); JasperPrint jpInvoicesReport = JasperFillManager.fillReport(invoicesReport, invoicesParamsMap, invoicesDataSource); List<JasperPrint> printList = new ArrayList<JasperPrint>(); printList.add(jpOrdersReport); printList.add(receiptsReport); printList.add(invoicesReport); JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, printList); exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, output); exporter.exportReport();
JRExporter exporter = new JRXhtmlExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream); exporter.exportReport();
public void writeTo(final HttpServletResponse _response) throws IOException, JRException { LOGGER.info("entering FileReportWriter.writeTo()"); final File file = File.createTempFile("djreport", ".tmp"); try { exporter.setParameter(JRExporterParameter.OUTPUT_FILE, file); exporter.exportReport(); _response.setContentLength((int)file.length()); copyStreams(new FileInputStream(file), _response.getOutputStream()); } finally { LOGGER.info("deleting " + file.getAbsolutePath()); file.delete(); } }
public void writeTo(final HttpServletResponse _response) throws IOException, JRException { LOGGER.info("entering MemoryReportWriter.writeTo(HttpServletResponse)"); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); exporter.exportReport(); _response.setContentLength(stream.size()); copyStreams(new ByteArrayInputStream(stream.toByteArray()), _response.getOutputStream()); }