zoukankan      html  css  js  c++  java
  • ASP.net 导出Excel数据攻略

    方法1.通过DateSet

    把DataSet内的数据,接每行/n结束,每行中的数据项/t分隔写入Response流,然后设置Content-Disposition.封装好的函数,如下:只需传入DataSet即可.

    Code

    方法2:通过DataGrid

    核心代码为:

      System.IO.StringWriter    stringWriter = new System.IO.StringWriter() ;
         System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (stringWriter);
         this.DataGrid1.RenderControl(hw);
         HttpContext.Current.Response.Write(tw.ToString());
         HttpContext.Current.Response.End();

  • 相关阅读:
    cron生成
    sp_addlinkedserver,Synonym
    上海城市坐标
    评分插件 jquery.raty.js
    ORA-12514: TNS:listener does not currently know of service requested in connect
    ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist
    工厂模式
    单例模式
    Qt中的Q_OBJECT作用, 以及信号槽
    DDLog-不同颜色打印信息
  • 原文地址:https://www.cnblogs.com/CUCmehp/p/1321575.html
Copyright © 2011-2022 走看看