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);
        }

  • 相关阅读:
    Ajax 的 GET 和 POST 模式
    AJax中post与get请求注意事项
    代理模式 (Proxy)
    装饰模式 (Decoratory)
    抽象工厂模式( Abstract Factory )
    单例模式(Singleton)
    原型设计模式
    Intro.js的简介和用法
    mysql 分片
    数据分片(二)如何为数据分片
  • 原文地址:https://www.cnblogs.com/sunheyubo/p/2377487.html
Copyright © 2011-2022 走看看