Jump to content
We've recently updated our Privacy Statement, available here ×

Chief

Members
  • Posts

    1
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by Chief

  1. 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!
×
×
  • Create New...