/** * */ public void xls() 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() + ".xls"); JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void docx() 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")); JRDocxExporter exporter = new JRDocxExporter(); exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.docx")); exporter.exportReport(); System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() 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() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("Report : " + sourceFile + ". XLSX creation time : " + (System.currentTimeMillis() - start)); } }
/** * */ public void xls() 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() + ".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 ods() 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() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * Fills the compiled report design loaded from the file received as the first parameter * and places the result in the file specified by the second parameter. * * @param sourceFileName source file containing the compile report design * @param destFileName file name to place the generated report into * @param params report parameters map * @param dataSource data source object */ public void fillToFile( String sourceFileName, String destFileName, Map<String,Object> params, JRDataSource dataSource ) throws JRException { File sourceFile = new File(sourceFileName); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); JasperReportsContext lcJrCtx = getLocalJasperReportsContext(sourceFile); JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, dataSource); JRSaver.saveObject(jasperPrint, destFileName); }
/** * */ public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XlsFormulaReport.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 xlsx() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XlsFormulaReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void ods() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/StretchReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); configuration.setFontSizeFixEnabled(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() 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() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XChartReport.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(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/I18nReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void ods() 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() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/FirstJasper.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx"); Map<String, String> dateFormats = new HashMap<String, String>(); dateFormats.put("EEE, MMM d, yyyy", "ddd, mmm d, yyyy"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setDetectCellType(true); configuration.setFormatPatternsMap(dateFormats); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void pptx() 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")); JRPptxExporter exporter = new JRPptxExporter(); exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.pptx")); exporter.exportReport(); System.err.println("PPTX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void ods() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XlsFormulaReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() 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() + ".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 xlsx() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/ParagraphsReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() 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() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(true); configuration.setProgressMonitor(new SimpleExportProgressMonitor()); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/LandscapeReport.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("build/reports/SpiderChart.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(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void pptx() 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() + ".pptx"); JRPptxExporter exporter = new JRPptxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimplePptxReportConfiguration configuration = new SimplePptxReportConfiguration(); configuration.setProgressMonitor(new SimpleExportProgressMonitor()); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("PPTX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/XlsxDataSourceReport.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("build/reports/CustomersReport.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(true); 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("build/reports/StyledTextReport.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("build/reports/TableOfContentsReport.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(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void ods() 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() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void ods() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/JFreeChartReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() 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")); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.xlsx")); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() 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() + ".xls"); JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(true); 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("build/reports/AllChartsReport.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)); }
/** * */ public void ods() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/RotationReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void ods() 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() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("ODS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/RotationReport.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 csv() 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")); JRCsvExporter exporter = new JRCsvExporter(); exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); exporter.setExporterOutput(new SimpleWriterExporterOutput("build/reports/BatchExportReport.csv")); exporter.exportReport(); System.err.println("CSV creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xls() 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")); JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.xls")); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLS creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void xlsx() throws JRException { long start = System.currentTimeMillis(); File sourceFile = new File("build/reports/TableReport.jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(false); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }
/** * */ public void docx() 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() + ".docx"); JRDocxExporter exporter = new JRDocxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); exporter.exportReport(); System.err.println("Report : " + sourceFile + ". DOCX creation time : " + (System.currentTimeMillis() - start)); } }
/** * */ public void ods() 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() + ".ods"); JROdsExporter exporter = new JROdsExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration(); configuration.setOnePagePerSheet(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("Report : " + sourceFile + ". ODT creation time : " + (System.currentTimeMillis() - start)); } }
/** * */ public void xlsx() 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() + ".xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile)); SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setOnePagePerSheet(false); configuration.setRemoveEmptySpaceBetweenRows(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start)); }