poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Mui <da...@muibros.com>
Subject Re: Excel File Download using JSP
Date Mon, 21 Jul 2003 19:14:29 GMT
I don't see where the output is written to the servlet stream so excel 
is not receiving the file poi created.

wb.write(response.getOutputStream());

would probably give you what you're looking for.



Andrew Riggin wrote:

> I searched through the entire mailing list looking for an answer to my 
> question but couldn't find one.
> Here is the situation:  I have one program that makes excel reports 
> from an Access database using POI.  This program saves the reports to 
> a Tomcat server on my system.  I have a JSP called DisplayReports 
> which uses a JavaBean to find the files on the server and post links 
> for each file to another JSP called DownloadFile.  When i link is 
> clicked on DisplayReports.jsp, it is suppose to run Downloads.jsp, the 
> Open/Save dialog box opens and then it down loads to the user 
> specified directory.  The relevant portion of the code in Download.jsp 
> looks like this:
>
> String filepath = dbBean.getDataPath();
>  response.setContentType("APPLICATION/OCTET-STREAM");
>  response.setHeader("Content-Disposition",
>  "attachment; filename=\"" + filename + "\"");
>
> POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filepath 
> + filename));
>    HSSFWorkbook wb = new HSSFWorkbook(fs);
>    FileOutputStream fileOut = new FileOutputStream(filename);
>
> wb.write(fileOut);
>    fileOut.close();
>
> It downloads the excel workbook with the correct name but their is no 
> data and no sheets.  What do I need to add?
>
> Thanks,
>
> Andrew
>
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>


Mime
View raw message