Aspose is going to introduce “Aspose.Cells for JasperReports” in near future
to convert reports from JasperReports in Excel format. Currently, Aspose
enables JasperReports developers to export their reports in PowerPoint (PPT,
PPS) and Word document (DOC, DOCX, HTML and TXT) formats.
I hope this reference URL will help
http://www.aspose.com/categories/jasperreports-exporters/default.aspx
mfarooq wrote:
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-tp14804459p22955701.html
Sent from the jasperreports-questions mailing list archive at Nabble.com.
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions