Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Commented Unassigned: How to stream .xlsx file back to client (browser) without first saving it to file system [12266]

$
0
0
Could you please show a code example for (creating and) streaming a .xlsx fiel back to the client.
I have it running for .xls and works perfect, but for .xlsx didn't get it working.

Nice component ! Keep up the good work !

Thanks.
Rishi
Comments: ** Comment from web user: stijnherreman **

@tonyqus Of course a stream should be closed, but it shouldn't be done by NPOI code. I create the stream, so it's my responsibility to close it. The following ASP.NET MVC code will crash because the stream is already closed before it can be returned:

```
var stream = new MemoryStream();
workbook.Write(stream);
return this.File(stream, mimeType, fileName + fileExtension);
```


Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>