You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dhiraj Dixit <dh...@tatainfotech.com> on 2005/09/23 15:48:35 UTC

Not able to open excel file

Hi all,

I m  trying to open  excel file in new window .What im doing is getting
workbook excel and paasinfg it into a blank jsp where i have wriiten a code
to open that workbook object .The code of that JSP is
---------------------------------------------------------------------------
excel=(ExcelVO)request.getAttribute(SessionConstants.SEARCH_NCM_SUMMARY_REPO
RT_CRITERIA);
       break;
   }
HSSFWorkbook wb = excel.getWorkbook();
String strName = excel.getReportName();
try {

 OutputStream output = response.getOutputStream();

 // SET THE MIME TYPE
 response.setContentType("application/vnd.ms-excel");

 // set content dispostion to attachment in
 // case the open/save dialog needs to appear
 response.setHeader("Content-disposition", "attachment; filename="+ strName
+".xls");
 wb.write(output);
 output.flush();
 output.close();
} catch (FileNotFoundException fne) {
 System.out.println("File not found...");
} catch (IOException ioe) {
- System.out.println("IOException..." + ioe.toString());
----------------------------------------------------------------------------
-------------------------------------------------

Now when im  able to save that file and view it properly but while when i go
"Open" option in dialogue box followuing errors come




Can anybody tell why this is happening .Please it's very urgent.



Thanks &Regards

Dhiraj  Dixit