Downloading Excel file after creating using EPPlus

后端 未结 4 1898
再見小時候
再見小時候 2021-01-02 01:20

I am using the EPPlus library to generate an excel file which I successfully save in a folder on the server.

How can download this file to my local machine?

<
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 01:43

    You can do like this:

    excel.Workbook.Properties.Title = "Attempts";
    this.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    this.Response.AddHeader("content-disposition",string.Format("attachment;  filename={0}", "ExcellData.xlsx"));
    this.Response.BinaryWrite(excel.GetAsByteArray());
    

    For detailed blog: http://sforsuresh.in/generating-and-formatting-excelsheet-in-c-using-epplus/

提交回复
热议问题