zoukankan      html  css  js  c++  java
  • 将ASP.NET 数据导出到execl

    图片 将上图数据保存到execl

    //导出到execl
            protected void Execl_Click(object sender, EventArgs e)
            {
                System.Web.UI.Control ctl = this.Repeater1;
                //Repeater1是你在窗体中拖放的控件
     
                HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Excel.xls");
                HttpContext.Current.Response.Charset = "UTF-8";
     
                HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
                HttpContext.Current.Response.ContentType = "application/ms-excel";
     
                ctl.Page.EnableViewState = false;
                System.IO.StringWriter tw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
                ctl.RenderControl(hw);
                HttpContext.Current.Response.Write(tw.ToString());
                HttpContext.Current.Response.End(); 
     

            }  图片 

     
     
  • 相关阅读:
    vue 分页 pagination
    查看android 签名文件keystore的有效期限
    cordova + vue 项目实现极光推送功能
    vue window
    input
    vue install 组件
    cordova 的安桌动画
    深度图
    css3 Transition动画执行时有可能会出现闪烁的bug
    windows zip命令
  • 原文地址:https://www.cnblogs.com/jiangyongyawen/p/4241343.html
Copyright © 2011-2022 走看看