zoukankan      html  css  js  c++  java
  • GridView導出Excel 解決亂碼問題

      Response.Clear();
            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);
            GridView1.AllowPaging = false;
            Bind();
            this.GridView1.RenderControl(hw);
            Response.Write(sw.ToString());
            Response.Write("</body></html>");
            Response.Flush();
            Response.End();
  • 相关阅读:
    牛客练习赛24 E:青蛙(最短路)
    菜根谭#10
    菜根谭#9
    菜根谭#8
    菜根谭#7
    菜根谭#6
    菜根谭#5
    菜根谭#4
    菜根谭#3
    菜根谭#2
  • 原文地址:https://www.cnblogs.com/siri/p/3225077.html
Copyright © 2011-2022 走看看