zoukankan      html  css  js  c++  java
  • 怎么样把GridView里的数据导出到Excel里

    怎么样把DataView里的数据导出到Excel里
    try
            {
                Response.Clear();
                Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
                Response.Charset = "gb2312";
                Response.ContentType = "application/vnd.xls";//设置输出文件类型为excel文件。
                System.IO.StringWriter stringWrite = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
                GridView1.AllowPaging = false;
                GridView1.RenderControl(htmlWrite);
                Response.Write(stringWrite.ToString());
                Response.End();
                GridView1.AllowPaging = true;
            }
            catch (Exception ee)
            {
                Response.Write(ee.Message.ToString());
            }
  • 相关阅读:
    第二阶段Sprint冲刺会议8
    第二阶段Sprint冲刺会议7
    第二阶段Sprint冲刺会议6
    问题账户需求分析
    2016年秋季个人阅读计划
    应该怎么做需求分析--读后感
    个人总结
    人月神话第三篇阅读笔记
    第十六周学习进度
    人月神话第二篇阅读笔记
  • 原文地址:https://www.cnblogs.com/sufei/p/1485994.html
Copyright © 2011-2022 走看看