Hi, I am using using jasper reports to generate my application reports but when I try to export my report in excel format but when excel file downloaded it contain rough data.
Below is my java source to export jasper report in excel format. Please help. byte[] pdf_ = null; Connection connection_ = DatabaseHandler.getConnection(); String jrxml_ = "/reports/jrxml/detailedxls.jrxml"; jrxml_ = this.getClass().getResource(jrxml_).getFile(); JasperDesign jasperDesign_ = JRXmlLoader.load(jrxml_); JasperReport jasperReport_ = JasperCompileManager.compileReport(jasperDesign_); ByteArrayOutputStream outputStream_ = new ByteArrayOutputStream(); if (null != paramMap) { JasperFillManager.fillReportToStream(jasperReport_, outputStream_,paramMap, connection_); } else { JasperFillManager.fillReportToStream(jasperReport_, outputStream_,new HashMap(), connection_); } JasperPrint jasperPrint_ = null; jasperPrint_ = JasperFillManager.fillReport(jasperReport_,paramMap, connection_); JRXlsExporter exporterXLS = new JRXlsExporter(); exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT,jasperPrint_); exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM,outputStream_); exporterXLS.exportReport(); pdf_ = outputStream_.toByteArray(); httpServletResponse.setContentType ("application/vnd.ms-excel"); httpServletResponse.addHeader("Content-disposition","attachment; filename=" + reportName_.toString() + ".xls"); httpServletResponse.getOutputStream().write(pdf_); Thanks in advance. -- View this message in context: http://www.nabble.com/Unable-to-export-jasper-report-in-excel-format-tp14804459p14804459.html Sent from the jasperreports-questions mailing list archive at Nabble.com. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions