public void export(HttpServletRequest req, HttpServletResponse res) throws Exception { String fileName=this.getExportFileName(req); fileName+=".rtf"; res.setContentType("application/octet-stream"); res.setHeader("Connection", "close"); res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\""); JRRtfExporter exporter = new JRRtfExporter(DefaultJasperReportsContext.getInstance()); JasperPrint jasperPrint=this.getJasperPrint(req); exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint); OutputStream ouputStream = res.getOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream); try { exporter.exportReport(); } catch (JRException e) { throw new ServletException(e); } finally { if (ouputStream != null) { ouputStream.flush(); ouputStream.close(); } } }
/** * */ public void rtf() throws JRException { File[] files = getFiles(new File("build/reports"), "jrprint"); for(int i = 0; i < files.length; i++) { long start = System.currentTimeMillis(); File sourceFile = files[i]; JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("Report : " + sourceFile + ". RTF creation time : " + (System.currentTimeMillis() - start)); } }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/ScriptletReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); SimpleRtfReportConfiguration configuration = new SimpleRtfReportConfiguration(); configuration.setProgressMonitor(new SimpleExportProgressMonitor()); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>(); jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint")); jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint")); jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint")); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); exporter.setExporterOutput(new SimpleWriterExporterOutput("build/reports/BatchExportReport.rtf")); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
@Override public void exportElement( JRRtfExporterContext exporterContext, JRGenericPrintElement element ) { try { JRRtfExporter exporter = (JRRtfExporter)exporterContext.getExporterRef(); exporter.exportImage(MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element)); } catch (Exception e) { throw new RuntimeException(e); } }
private Exporter createExporter(ExportType type) { switch (type) { case CSV: return new JRCsvExporter(); case RTF: return new JRRtfExporter(); case XLS: return new JRXlsExporter(); case ODT: return new JROdtExporter(); case ODS: return new JROdsExporter(); case DOCX: return new JRDocxExporter(); case XLSX: return new JRXlsxExporter(); case PPTX: return new JRPptxExporter(); default: return null; } }
public static byte[] getRtf(JasperPrint jasperPrint) throws JRException { byte[] content = null; ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); JRRtfExporter exporter = new JRRtfExporter(); content = getBytes(exporter, baos, jasperPrint); } finally { if (baos != null) { try { baos.flush(); baos.close(); } catch (Exception e) { e.printStackTrace(); } } } return content; }
@Override public void save(JasperPrint jasperPrint, File file) throws JRException { if(!file.getName().toLowerCase().endsWith(EXTENSION_RTF)) { file = new File(file.getAbsolutePath() + EXTENSION_RTF); } if ( !file.exists() || JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( null, MessageFormat.format( getBundleString("file.exists"), new Object[]{file.getName()} ), getBundleString("save"), JOptionPane.OK_CANCEL_OPTION ) ) { JRRtfExporter exporter = new JRRtfExporter(getJasperReportsContext()); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(file)); exporter.exportReport(); } }
public void exportRtf() throws JRException { JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(this.output .getAbsolutePath() + ".rtf")); exporter.exportReport(); }
@Override protected JRRtfExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) { JRRtfExporter exp = new JRRtfExporter(jContext); exp.setExporterOutput(new SimpleWriterExporterOutput(file)); SimpleRtfReportConfiguration rconf = new SimpleRtfReportConfiguration(); setupReportConfiguration(rconf, monitor); exp.setConfiguration(rconf); return exp; }
/** * Exports by MIME type. * * @param mimeType MIME type * @param jp Jasper print * @param os outputstream * @throws JRException */ protected void export(String mimeType, JasperPrint jp, OutputStream os) throws JRException { if ("application/pdf".equalsIgnoreCase(mimeType)) { exportReport(new JRPdfExporter(), jp, os); } else if ("text/xml".equalsIgnoreCase(mimeType)) { exportReport(new HtmlExporter(), jp, os); } else if ("application/rtf".equalsIgnoreCase(mimeType)) { exportReport(new JRRtfExporter(), jp, os); } else if ("application/xls".equalsIgnoreCase(mimeType)) { exportReport(new JRXlsExporter(), jp, os); } else if ("application/odt".equalsIgnoreCase(mimeType)) { exportReport(new JROdtExporter(), jp, os); } else if ("application/ods".equalsIgnoreCase(mimeType)) { exportReport(new JROdsExporter(), jp, os); } else if ("application/docx".equalsIgnoreCase(mimeType)) { exportReport(new JRDocxExporter(), jp, os); } else if ("application/xlsx".equalsIgnoreCase(mimeType)) { exportReport(new JRXlsxExporter(), jp, os); } else if ("application/pptx".equalsIgnoreCase(mimeType)) { exportReport(new JRPptxExporter(), jp, os); } else if ("text/xhmtl".equalsIgnoreCase(mimeType)) { exportReport(new JRXhtmlExporter(), jp, os); } else { throw new IllegalArgumentException("JasperRenderer does not support " + mimeType + " MIME type."); } }
protected void rtf(JasperPrint print, String destFile) throws JRException, IOException { log.debug("exporting to rtf file: " + destFile); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(print)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); }
private void exportToRTF() { log.debug("exporting to RTF"); rtfExporter = new JRRtfExporter(); rtfExporter.setParameters(getExportParameters()); try { start = System.currentTimeMillis(); rtfExporter.exportReport(); log.info("export running time (msec): " + (System.currentTimeMillis() - start)); } catch (JRException jre) { jre.printStackTrace(); log.error(jre.getCause()); } }
private JRRtfExporter rtf(JasperIRtfExporter jasperExporter) { SimpleWriterExporterOutput exporterOutput = simpleWriterExporterOutput(jasperExporter); SimpleRtfReportConfiguration reportExportConfiguration = new SimpleRtfReportConfiguration(); reportExportConfiguration(reportExportConfiguration, jasperExporter); if (jasperExporter.getIgnoreHyperLink() != null) { reportExportConfiguration.setIgnoreHyperlink(jasperExporter.getIgnoreHyperLink()); } SimpleRtfExporterConfiguration exporterConfiguration = new SimpleRtfExporterConfiguration(); JRRtfExporter jrExporter = new JRRtfExporter(); jrExporter.setExporterOutput(exporterOutput); jrExporter.setConfiguration(reportExportConfiguration); jrExporter.setConfiguration(exporterConfiguration); return jrExporter; }
@Override public void exportElement(JRRtfExporterContext exporterContext, JRGenericPrintElement element) { try { JRRtfExporter exporter = (JRRtfExporter) exporterContext.getExporter(); JRPrintImage image = WmsMapElementImageProvider.getImage( exporterContext.getJasperReportsContext(), element); exporter.exportImage(image); } catch (Exception e) { throw new RuntimeException(e); } }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/UnicodeReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/BookReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/Barcode4JReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/DataSourceReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/FontsReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/FormsReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/StyledTextReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/MapReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/TabularReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XYChart.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/QueryReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/ShapesReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/CustomersReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/MasterReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/NoXmlDesignReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/NoPageBreakReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XlsDataSourceReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/HorizontalReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/HyperlinkReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/MarkupReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void rtf() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/StylesReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf"); JRRtfExporter exporter = new JRRtfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("RTF creation time : " + (System.currentTimeMillis() - start)); }