求dataGridView导出数据到Execl 最快的方法最常见的是遍历导出!!!请问有没有别的 更快速 导出更多数据的方法? 最好一次性的那种!!谢谢了

解决方案 »

  1.   

    private void Download(Control ctl)
        {
            
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=details.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 = true;        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();
                }参数传入控件
      

  2.   

    将数据表导出即可。遍历表内容,再用XMLWRITER写入到文件中
      

  3.   



    孟子E章 前辈的。
    服务器不用安装 office
      

  4.   

    http://dotnet.aspx.cc/file/Export-Gridview-To-Excel-With-Multi-Sheet.aspx
    忘记发链接了。囧