See if any of the suggestions in http://jakarta.apache.org/poi/faq.html#faq-7 
help you. The faq is written from the point of view of servelet use, but the 
problems and solutions apply to JSP as well. 

Quoting ibo <[EMAIL PROTECTED]>:

> Im trying to code a routine for downloading the
> generated excel file
> thru JSP, by writing the data object directly to the
> client side.
> my code snippet :
> 
>       fs = new POIFSFileSystem(new
> FileInputStream(fileTemplate));
>       wb = new HSSFWorkbook(fs);
>       ...     
>       ServletOutputStream stream =
> response.getOutputStream();
>       
>       response.setContentType("application/vnd.ms-excel");
>       response.setHeader("Content-Disposition",
> "attachment; filename=\"" + fileName + "\"");
>       
>       wb.write(stream);
>       stream.close();
> 
> this code doesnt seem to work, the file gets
> downloaded and written to a file
> but the content looks garbled or corrupted, although i
> can open the file thru
> MS Excel w/o getting an "illegal operation" or any
> errors.
> remember that this code snippet is inside a JSP file
> and it looks like
> the data was written not in binary but in ascii.. or
> something like that.
> what am i missing? anyone with a working code? => does
> POI library
> handles this one properly? (i tried writing it to a
> file and works perfectly).
> i also tried the code in servlet but i get the same results.
> 
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to