Chief Posted October 6, 2006 Share 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! Link to comment Share on other sites More sharing options...
lucianc Posted October 6, 2006 Share Posted October 6, 2006 filename is null for XLS. Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now