Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Downloading the generated file instead of saving

$
0
0
Found it! In case anyone else wondered
HttpContext.Current.Response.Clear()
        HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=AddingDataSet.xlsx")

        Using memoryStream As New MemoryStream()
            workbook.SaveAs(memoryStream)
            memoryStream.WriteTo(HttpContext.Current.Response.OutputStream)
            memoryStream.Close()
        End Using

        HttpContext.Current.Response.[End]()

Viewing all articles
Browse latest Browse all 1877

Trending Articles



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