怎么样把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());
        }

相关文章:

  • 2022-12-23
  • 2021-12-13
  • 2021-12-18
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2021-12-29
猜你喜欢
  • 2021-08-01
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案