public void exportCsvMeta() throws JRException { JRCsvMetadataExporter exporter = new JRCsvMetadataExporter(); SimpleCsvMetadataExporterConfiguration configuration = new SimpleCsvMetadataExporterConfiguration(); configuration.setFieldDelimiter(config.getOutFieldDel()); exporter.setConfiguration(configuration); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput( this.output.getAbsolutePath() + ".csv", config.getOutCharset())); exporter.exportReport(); }
@Override protected JRCsvMetadataExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) { JRCsvMetadataExporter exp = new JRCsvMetadataExporter(jContext); exp.setExporterOutput(new SimpleWriterExporterOutput(file)); SimpleCsvMetadataReportConfiguration rconf = new SimpleCsvMetadataReportConfiguration(); setupReportConfiguration(rconf, monitor); exp.setConfiguration(rconf); return exp; }
/** * */ public void csvMetadata() 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() + ".metadata.csv"); JRCsvMetadataExporter exporter = new JRCsvMetadataExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("CSV creation time : " + (System.currentTimeMillis() - start)); }