Response.Charset ="gb2312";
        Response.Buffer
=true;
        Response.AddHeader(
"content-disposition", "attachment;filename="+ HttpUtility.UrlEncode("用户信息表.xls").ToString());
        Response.ContentType
="application/ms-excel";
        Response.Write(
"<html><head><meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">");
        System.IO.StringWriter sw
=new System.IO.StringWriter();
        HtmlTextWriter hw
=new HtmlTextWriter(sw);
       
this.GridView1.RenderControl(hw);
        Response.Write(sw.ToString());
        Response.Write(
"</body></html>");
        Response.Flush();
        Response.End();

像这样写问题就解决了。

相关文章:

  • 2021-12-07
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-11-12
  • 2021-12-04
  • 2022-12-23
  • 2021-07-30
猜你喜欢
  • 2021-11-23
  • 2021-11-22
  • 2022-12-23
  • 2022-01-28
  • 2022-02-19
  • 2022-12-23
相关资源
相似解决方案