How to download the generated file?

Mar 14, 2016 at 3:57 PM
How to download the generated file and let the user to save it at any location?
Mar 23, 2016 at 2:36 PM
Edited Mar 23, 2016 at 2:36 PM
You'll have to save your workbook as a memorystream and write it to the HttpResponse. Something like this:
using (XLWorkbook wb = new XLWorkbook())
    // create your workbook here "MyWorkBook"

    // then send it to the http response...

    Response.Buffer = true;
    Response.Charset = "";
    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    Response.AddHeader("content-disposition", "attachment;filename=Report.xlsx");

    using (MemoryStream ms = new MemoryStream())
Marked as answer by merlyn333 on 4/29/2016 at 6:12 AM
Apr 29, 2016 at 12:44 PM
Edited Apr 29, 2016 at 1:12 PM
Sorry, I just read your message.

That was awesome!

Thanks for your help!

Now it works as expected.