Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2011, 07:36 AM
Registered User
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exel Repoert not crating

Hi All.

In Our Project we r using Jasper to generate report in the Xls, we are supposed to use jasperreports-3.5.3 and poi 3.5... but Xls is not generating and even server is not throwing any exception...

Pls help on this..

below is my code snippet



try{
LightDatabaseManager dbManager = new LightDatabaseManager(this);
JasperReport jasperReport = (JasperReport) JRLoader.loadObjectFromLocation(
reportDetail.getFilePath());
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameterMap,
dbManager.getConnection());
exportToFile(reportDetail, jasperPrint);
}
catch(Exception e){
e.printStackTrace();
logger.error("XXXXXXXXXXXX"+e);
}




private void exportToFile(NBReportConfigLEnum reportDetail, JasperPrint jasperPrint)
throws JRException{
logger.debug("...................................I nside exportToFile.............");
try{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
switch(reportDetail.getFileResponse()){
case PDF:
JasperExportManager.exportReportToPdfStream(jasper Print, baos);
servletResponse.setContentLength(baos.size());
setInputStream(new ByteArrayInputStream(baos.toByteArray()));
break;
case XLS:
logger.debug(".....Inside XLS......");
JRXlsExporter exporterXLS = new JRXlsExporter();
logger.debug(".....exporterXLS......"+exporterXLS) ;
exporterXLS.setParameter(JRXlsExporterParameter.JA SPER_PRINT, jasperPrint);
logger.debug(".....After JASPER_PRINT......");
exporterXLS.setParameter(JRXlsExporterParameter.OU TPUT_STREAM, baos);
logger.debug(".....After OUTPUT_STREAM......");
exporterXLS.setParameter(JRXlsExporterParameter.IS _ONE_PAGE_PER_SHEET,
Boolean.FALSE);
logger.debug(".....After IS_ONE_PAGE_PER_SHEET......");
exporterXLS.setParameter(JRXlsExporterParameter.IS _DETECT_CELL_TYPE,
Boolean.TRUE);
logger.debug(".....After IS_DETECT_CELL_TYPE......");
exporterXLS.setParameter(JRXlsExporterParameter.IS _WHITE_PAGE_BACKGROUND,
Boolean.FALSE);
logger.debug(".....After IS_WHITE_PAGE_BACKGROUND......");
exporterXLS.setParameter(JRXlsExporterParameter.IS _REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
Boolean.TRUE);
logger.debug(".....After IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS......");

try {
logger.debug(".....Inside exportReport block......");
exporterXLS.exportReport(); logger.debug(".....After exportReport......");
}catch(Exception ex) {
logger.error("Exception in exportReport() ::: "+ex);
ex.printStackTrace();
}

try {
servletResponse.setContentLength(baos.size());
servletResponse.setContentType("application/vnd.ms-excel");
setInputStream(new ByteArrayInputStream(baos.toByteArray()));
}catch(Exception ex) {
logger.error("Exception when setting servletResponce in exportToFile() :::"+ex);
ex.printStackTrace();
}
break;
default:
break;
}
}
catch(Exception e){
e.printStackTrace();

}
}
}


exporterXLS.exportReport() is invoking but it's not throwing any exception and not generating any Xls..

Last edited by kusha85; May 10th, 2011 at 07:53 AM..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Exel to XML karephul XML 2 June 14th, 2006 03:27 PM



All times are GMT -4. The time now is 07:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.