You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Richard Gathogo <mu...@gmail.com> on 2013/03/20 09:10:33 UTC

Creating an excel document to an output stream

Hi all,
I have a web application where some users can export their data to an excel
document. I would like export the data directly to the output stream so
that the download starts immediately the export starts instead of first of
creating a workbook then writing the work book to my output stream. Is
there anyone with an idea on how I can achieve this?
Regards Richard.

Re: Creating an excel document to an output stream

Posted by Nick Burch <ap...@gagravarr.org>.
On Wed, 20 Mar 2013, Richard Gathogo wrote:
> I have a web application where some users can export their data to an excel
> document. I would like export the data directly to the output stream so
> that the download starts immediately the export starts instead of first of
> creating a workbook then writing the work book to my output stream. Is
> there anyone with an idea on how I can achieve this?

The excel file format has back-and-forth references, so it's not something 
that can be streamed during writing. (.xlsx is slightly better, and some 
parts can be written in a streaming way by SXSSF, but not the whole 
thing). You'll need to build the workbook up in memory, then have it write 
out to your servlet output stream. You might need to open it first though 
in chunked mode, and send some empty frames, to stop the browser getting 
bored and deciding the download has failed. Pretty sure there's some 
examples in the list archives

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org