Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2008, 05:45 AM
Registered User
 
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default genrating the excel report

Hi i want to genrate the excel report to the browser, as it should prompt with dialouge box to download the file or to open.

Below is the snippet of code, which the result is showing in browser as text.

if (reportFormat.equals("EXCEL")) {
System.out.println(" EXCEL report to be genarted ");
jrExporter = new JRXlsExporter();
jrExporter.setParameter(JRXlsExporterParameter.IS_ ONE_PAGE_PER_SHEET, Boolean.TRUE);
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment; filename=" + reportName + ".xls" );
response.setHeader("pragma", "no-cache");
response.setHeader("Pragma", "public" );
response.setHeader("Cache-Control","no-cache");
response.setHeader("Cache-Control","must-revalidate");

ServletOutputStream out = response.getOutputStream();
System.out.println(" servlet output stream initialized...");
jrExporter.setParameter(JRExporterParameter.JASPER _PRINT, jasperPrint);
System.out.println("jasperPrint has been set...");
jrExporter.setParameter(JRExporterParameter.OUTPUT _STREAM, out);
System.out.println("out put stream has been set...");
jrExporter.exportReport();
System.out.println("jrExporter exported report...");
out.flush();
out.close();
System.out.println("Completed...");
}

Kinldy let me know where it's going wrong

Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Break in Excel Report diptypatil J2EE 0 October 23rd, 2007 06:37 AM
Converting report to Excel anukagni Access 2 February 18th, 2006 03:34 AM
Transferring Access Report to Excel rklass BOOK: Access 2003 VBA Programmer's Reference 0 August 5th, 2005 08:46 PM
error in excel report rendering. hemantkanchan BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 January 5th, 2005 02:49 AM
Excel Report from XML Vasudevan XML 2 August 14th, 2003 06:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.