zoukankan      html  css  js  c++  java
  • repeater导出到Excel

     1 protected void CopyToExcel() {
     2         Response.Clear();
     3         Response.Buffer = true;
     4         Response.Charset = "utf-8";
     5         Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("test", System.Text.Encoding.UTF8) + ".xls");
     6         Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
     7         Response.ContentType = "application/ms-excel";  
     8         this.EnableViewState = false;
     9         System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
    10         System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
    11         System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
    12        
    13         this.rptResult.RenderControl(oHtmlTextWriter);
    14         Response.Write(oStringWriter.ToString());
    15         Response.End();
    16     }
  • 相关阅读:
    day58
    day57
    day55
    day56
    day54
    Vue(练习二)
    Vue练习
    Vue框架
    作业
    Django(九)
  • 原文地址:https://www.cnblogs.com/xiaoyu5062/p/2951980.html
Copyright © 2011-2022 走看看