You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "John D. Ament" <jo...@apache.org> on 2018/03/21 17:54:58 UTC

Generating large spreadsheets and streaming responses

Hi

I was wondering, are there any solutions in POI for streaming large
spreadsheets over an HTTP response?  I have a JAX-RS backend that I
currently seed with POI.  I use StreamingOutput to stream the worksheet to
the client.  The problem is that this approach requires the entire
spreadsheet to be created in memory first and then sent over the wire.  I'd
like to be able to send it out in a stream for performance reasons, as well
as getting the HTTP response sent out quicker.

John

Re: Generating large spreadsheets and streaming responses

Posted by Dominik Stadler <do...@gmx.at>.
Not directly because the XML/ZIP format is not designed to support
streaming writing.

But there is SXSSFWorkbook which will write the content to a temporary file
while rows/cells are added and this way can build a potentially large .xlsx
file on disk without requiring a huge amount of memory. You can then stream
the resulting file as normal streaming copy from file to HTTP response,
also not requiring too much memory.

Dominik.

On Wed, Mar 21, 2018 at 6:54 PM, John D. Ament <jo...@apache.org>
wrote:

> Hi
>
> I was wondering, are there any solutions in POI for streaming large
> spreadsheets over an HTTP response?  I have a JAX-RS backend that I
> currently seed with POI.  I use StreamingOutput to stream the worksheet to
> the client.  The problem is that this approach requires the entire
> spreadsheet to be created in memory first and then sent over the wire.  I'd
> like to be able to send it out in a stream for performance reasons, as well
> as getting the HTTP response sent out quicker.
>
> John
>