Adding XLS to PDF and HTML reports in Products Posted October 6, 2006 Hello, I'm adding XLS to an existing reports setup that works perfectly for PDF and HTML reports. The code I'm working with is:Code: public String generateReport(String reportname, int outputtype, Map props){ String filename = null; props.put("outputdir",outputdir); props.put("inputdir",inputdir); props.put("filetype",ReportGenerator.getTypeName(outputtype)); try { JasperPrint print = JasperFillManager.fillReport(inputdir+"/"+reportname+".jasper",props,db); switch(outputtype){ case HTML_TYPE: filename = outputdir+"/"+reportname+"-"+System.currentTimeMillis()+".html"; JasperExportManager.exportReportToHtmlFile(print,filename); break; case PDF_TYPE: filename = outputdir+"/"+reportname+"-"+System.currentTimeMillis()+".pdf"; JasperExportManager.exportReportToPdfFile(print,filename); break; case XLS_TYPE: JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, filename ); exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.exportReport(); break; } } catch (JRException e){ System.out.println("An error occured loading the report."«»); e.printStackTrace(); System.exit(-1); } return filename; } The HTML and PDF work great but the XLS gives: net.sf.jasperreports.engine.JRException: No output specified for the exporter. at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:151)ports.ReportGenerator.main(ReportGenerator.java:158) Is there something simple I'm missing? Any and all help is appreciated!
Adding XLS to PDF and HTML reports
in Products
Posted
Hello,
I'm adding XLS to an existing reports setup that works perfectly for PDF and HTML reports.
The code I'm working with is:
The HTML and PDF work great but the XLS gives:
net.sf.jasperreports.engine.JRException: No output specified for the exporter.
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:151)
ports.ReportGenerator.main(ReportGenerator.java:158)
Is there something simple I'm missing? Any and all help is appreciated!