Search in sources :

Example 1 with ExporterOutput

use of net.sf.jasperreports.export.ExporterOutput in project midpoint by Evolveum.

the class ReportCreateTaskHandler method generateReport.

private String generateReport(ReportType reportType, JasperPrint jasperPrint) throws JRException {
    String destinationFileName = getDestinationFileName(reportType);
    switch(reportType.getExport()) {
        case PDF:
            JasperExportManager.exportReportToPdfFile(jasperPrint, destinationFileName);
            break;
        case XML:
            JasperExportManager.exportReportToXmlFile(jasperPrint, destinationFileName, true);
            break;
        case XML_EMBED:
            JasperExportManager.exportReportToXmlFile(jasperPrint, destinationFileName, true);
            break;
        case XHTML:
        case HTML:
            JasperExportManager.exportReportToHtmlFile(jasperPrint, destinationFileName);
            break;
        case CSV:
            JRCsvExporter csvExporter = new JRCsvExporter();
            csvExporter.setExporterInput(new SimpleExporterInput(jasperPrint));
            csvExporter.setExporterOutput(new SimpleWriterExporterOutput(destinationFileName));
            csvExporter.exportReport();
            break;
        case RTF:
        case XLS:
        case ODT:
        case ODS:
        case DOCX:
        case XLSX:
        case PPTX:
        case JXL:
            ExporterInput input = new SimpleExporterInput(jasperPrint);
            ExporterOutput output = new SimpleOutputStreamExporterOutput(destinationFileName);
            Exporter exporter = createExporter(reportType.getExport());
            if (exporter == null) {
                break;
            }
            exporter.setExporterInput(input);
            exporter.setExporterOutput(output);
            exporter.exportReport();
            break;
        default:
            break;
    }
    return destinationFileName;
}
Also used : SimpleWriterExporterOutput(net.sf.jasperreports.export.SimpleWriterExporterOutput) SimpleOutputStreamExporterOutput(net.sf.jasperreports.export.SimpleOutputStreamExporterOutput) JRCsvExporter(net.sf.jasperreports.engine.export.JRCsvExporter) SimpleExporterInput(net.sf.jasperreports.export.SimpleExporterInput) SimpleWriterExporterOutput(net.sf.jasperreports.export.SimpleWriterExporterOutput) SimpleOutputStreamExporterOutput(net.sf.jasperreports.export.SimpleOutputStreamExporterOutput) ExporterOutput(net.sf.jasperreports.export.ExporterOutput) JRPptxExporter(net.sf.jasperreports.engine.export.ooxml.JRPptxExporter) Exporter(net.sf.jasperreports.export.Exporter) JRDocxExporter(net.sf.jasperreports.engine.export.ooxml.JRDocxExporter) JRCsvExporter(net.sf.jasperreports.engine.export.JRCsvExporter) JROdtExporter(net.sf.jasperreports.engine.export.oasis.JROdtExporter) JRXlsExporter(net.sf.jasperreports.engine.export.JRXlsExporter) JRXlsxExporter(net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter) JRRtfExporter(net.sf.jasperreports.engine.export.JRRtfExporter) JROdsExporter(net.sf.jasperreports.engine.export.oasis.JROdsExporter) ExporterInput(net.sf.jasperreports.export.ExporterInput) SimpleExporterInput(net.sf.jasperreports.export.SimpleExporterInput)

Aggregations

JRCsvExporter (net.sf.jasperreports.engine.export.JRCsvExporter)1 JRRtfExporter (net.sf.jasperreports.engine.export.JRRtfExporter)1 JRXlsExporter (net.sf.jasperreports.engine.export.JRXlsExporter)1 JROdsExporter (net.sf.jasperreports.engine.export.oasis.JROdsExporter)1 JROdtExporter (net.sf.jasperreports.engine.export.oasis.JROdtExporter)1 JRDocxExporter (net.sf.jasperreports.engine.export.ooxml.JRDocxExporter)1 JRPptxExporter (net.sf.jasperreports.engine.export.ooxml.JRPptxExporter)1 JRXlsxExporter (net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter)1 Exporter (net.sf.jasperreports.export.Exporter)1 ExporterInput (net.sf.jasperreports.export.ExporterInput)1 ExporterOutput (net.sf.jasperreports.export.ExporterOutput)1 SimpleExporterInput (net.sf.jasperreports.export.SimpleExporterInput)1 SimpleOutputStreamExporterOutput (net.sf.jasperreports.export.SimpleOutputStreamExporterOutput)1 SimpleWriterExporterOutput (net.sf.jasperreports.export.SimpleWriterExporterOutput)1