Search in sources :

Example 1 with SimpleXlsxReportConfiguration

use of net.sf.jasperreports.export.SimpleXlsxReportConfiguration 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);
    }
}
Also used : JRException(net.sf.jasperreports.engine.JRException) SimpleOutputStreamExporterOutput(net.sf.jasperreports.export.SimpleOutputStreamExporterOutput) SimpleExporterInput(net.sf.jasperreports.export.SimpleExporterInput) SimpleXlsxReportConfiguration(net.sf.jasperreports.export.SimpleXlsxReportConfiguration) JRXlsxExporter(net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter)

Aggregations

JRException (net.sf.jasperreports.engine.JRException)1 JRXlsxExporter (net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter)1 SimpleExporterInput (net.sf.jasperreports.export.SimpleExporterInput)1 SimpleOutputStreamExporterOutput (net.sf.jasperreports.export.SimpleOutputStreamExporterOutput)1 SimpleXlsxReportConfiguration (net.sf.jasperreports.export.SimpleXlsxReportConfiguration)1