wangsheng
2021-11-30 7f9be85686afe6ed9ac364e6b3539645b834722d
web/App_Code/WebTool.cs
@@ -45,7 +45,8 @@
  {
    StringBuilder stringBuilder = new StringBuilder();
    //stringBuilder.Append("<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset=UTF-8\"/>");//旧的-导出xls
    stringBuilder.Append("<meta http-equiv=\"content-type\" content=\"vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8\"/>");//导出格式xlsx
        //stringBuilder.Append("<meta http-equiv=\"content-type\" content=\"vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8\"/>");//导出格式xlsx
        stringBuilder.Append("<meta http-equiv=\"content-type\" content=\"text/csv\"/>");//导出格式xlsx
    stringBuilder.AppendLine("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
    stringBuilder.AppendLine("<tr>");
    foreach (KeyValuePair<string, string> keyValuePair in dictionary)
@@ -77,8 +78,10 @@
    }
    stringBuilder.AppendLine("</table>");
    Response.ClearContent();
    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".xlsx");
    Response.ContentType = "application/excel";
        Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + ".csv");
        Response.ContentType = "text/csv";
    //Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".xlsx");
    //Response.ContentType = "application/execl";
    Response.ContentEncoding = Encoding.UTF8;
    Response.Write(stringBuilder.ToString());
    Response.End();