It is not uncommon to request reports in Microsoft Excel format since Excel allows easy manipulation of report data to perform calculations. JasperReports provides built-in capability to export reports to Excel. The following example demonstrates this functionality:
package net.ensode.jasperbook; import java.io.File; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.export.JRXlsExporter; import net.sf.jasperreports.engine.export.JExcelApiExporter; import net.sf.jasperreports.engine.util.JRLoader; public class XlsExportDemo { public static final String REPORT_DIRECTORY = "reports"; public void xlsExport(String reportName) { File file = new File(REPORT_DIRECTORY + "/" + reportName + ".jrprint"); try { JasperPrint jasperPrint = (JasperPrint) JRLoader.loadObject(file); JExcelApiExporter xlsExporter = new JExcelApiExporter...