use of net.sf.jasperreports.export.SimpleExporterInput in project java-examples by urvanov-ru.
the class App method generateReport.
public static void generateReport() throws JRException, IOException {
JasperDesign jasperDesign = createDesign();
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JRDataSource jrDataSource = prepareDataSource();
Map<String, Object> params = new HashMap<String, Object>();
params.put("startDate", new Date());
params.put("endDate", new Date());
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, jrDataSource);
try (FileOutputStream baos = new FileOutputStream("dynamicReport.xls")) {
JRXlsExporter xlsExporter = new JRXlsExporter();
xlsExporter.setExporterInput(new SimpleExporterInput(jasperPrint));
xlsExporter.setExporterOutput(new SimpleOutputStreamExporterOutput(baos));
SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
configuration.setOnePagePerSheet(false);
xlsExporter.setConfiguration(configuration);
xlsExporter.exportReport();
}
}
use of net.sf.jasperreports.export.SimpleExporterInput in project archi by archimatetool.
the class JasperReportsExporter method exportRTF.
void exportRTF(JasperPrint jasperPrint, File file) throws JRException {
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleWriterExporterOutput(file));
exporter.exportReport();
}
use of net.sf.jasperreports.export.SimpleExporterInput in project archi by archimatetool.
the class JasperReportsExporter method exportPPT.
void exportPPT(JasperPrint jasperPrint, File file) throws JRException {
JRPptxExporter exporter = new JRPptxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(file));
exporter.exportReport();
}
use of net.sf.jasperreports.export.SimpleExporterInput in project archi by archimatetool.
the class JasperReportsExporter method exportODT.
void exportODT(JasperPrint jasperPrint, File file) throws JRException {
JROdtExporter exporter = new JROdtExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(file));
exporter.exportReport();
}
use of net.sf.jasperreports.export.SimpleExporterInput in project tutorials by eugenp.
the class SimpleReportExporter method exportToXlsx.
public void exportToXlsx(String fileName, String sheetName) {
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(fileName));
SimpleXlsxReportConfiguration reportConfig = new SimpleXlsxReportConfiguration();
reportConfig.setSheetNames(new String[] { sheetName });
exporter.setConfiguration(reportConfig);
try {
exporter.exportReport();
} catch (JRException ex) {
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
}
}
Aggregations