zoukankan      html  css  js  c++  java
  • GridView导出 Excel文件内容出现乱码

     Response.Charset = "GB2312";
                Response.Charset = "";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
                Response.AppendHeader("Content-Disposition""attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8) + ".xls\"");
                Response.ContentType = "application/ms-excel";
                Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=GB2312\">");

                System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
                xPanel.RenderControl(oHtmlTextWriter);
                Response.Write(oStringWriter.ToString());
                Response.End();

    //以下不加也没报错,有的说要加上

    public override void VerifyRenderingInServerForm(Control control)
        {
            //base.VerifyRenderingInServerForm(control);
        }

  • 相关阅读:
    xen xl命令记录
    fiefox 自动下载文件配置
    ActionChains用法
    WebDriverWait
    python3 安装selenium
    mysql 不能执行delete检查safe-updates模式
    shell 自动部署替换版本和备份
    matlab 非线性拟合
    【递归】1208:2的幂次方表示
    二进制和位运算符
  • 原文地址:https://www.cnblogs.com/sunheyubo/p/2377487.html
Copyright © 2011-2022 走看看