ASP.NET 弹出保存对话框

    xiaoxiao2026-04-18  3

    string fileName = id + ".xlsx"; string path = Path.Combine(ExportPath, fileName); NPOIExcelHelper.DataTable2Excel(table, path, "sheet1"); HttpContext.Response.ClearContent(); HttpContext.Response.Clear(); HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, Encoding.UTF8)); HttpContext.Response.ContentType = "application/ms-excel"; HttpContext.Response.Charset = "UTF-8"; HttpContext.Response.ContentEncoding = Encoding.UTF8; HttpContext.Response.TransmitFile(path); HttpContext.Response.Flush(); HttpContext.Response.End();
    转载请注明原文地址: https://ju.6miu.com/read-1308966.html
    最新回复(0)