[jasperreports-questions] Problem in Displaying Colors and formatting in Excel report

2009-04-12 Thread sureshmidde

Hi , 
I have a problem in displaying the excel report from the jasper code, as it
was not matching with the one that is developed using ireport tool. The
resultant report is now of formatting, data is truncated and is without
colors.

I have attached my excel report template developed using ireport 
http://www.nabble.com/file/p22946828/PreopeningDocsReport20090407122734.xls
PreopeningDocsReport20090407122734.xls 

And here is my jrxml file , 
http://www.nabble.com/file/p22946828/report1.jrxml report1.jrxml 

And i m using java code as 


String sourceFile = E:\\finalreport\\report1.jrxml;

System.out.println(sourceFile:+sourceFile);
JasperDesign jasperDesign = JRXmlLoader.load( 
preopeningDocsJrxmlLocation
);

// --- Compile the master jrxml file
JasperReport report = 
JasperCompileManager.compileReport( jasperDesign );

// --- Fill the report passing the datasource/jdbc 
connection
JasperPrint jasperPrint = JasperFillManager.fillReport( 
report,
parameters, conn );


OutputStream outputStream = response.getOutputStream();


JExcelApiExporter exporter = null;
exporter = new JExcelApiExporter();

exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,
Boolean.TRUE);

exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,
Boolean.FALSE);

exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
Boolean.FALSE);

exporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM,
outputStream);
response.setContentType(application/vnd.ms-excel);
response.setHeader(Content-Disposition, inline;
filename=\file.xls\);
exporter.exportReport();


Can any one help me in this regard

regards
Suresh Midde
-- 
View this message in context: 
http://www.nabble.com/Problem-in-Displaying-Colors-and-formatting-in-Excel-report-tp22946828p22946828.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


Re: [jasperreports-questions] Unable to export jasper report in excel format

2009-04-12 Thread Usman Sarfraz

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