荷梅月剑 编程之路

这个世界没有偶然,有的只是必然
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

DataSet生成EXCL(未测试)

Posted on 2007-08-14 14:39  荷梅月剑  阅读(156)  评论(0)    收藏  举报
DataSet ds=new DataSet();
                    ds
=(DataSet)(Session["ExcelInfo"]);
                    
this.DataGrid1.DataSource=ds;
                    
this.DataGrid1.DataBind();
                    Response.ContentType
="application nd.ms-excel";
                    Response.Charset
="";
                    EnableViewState
=false;
                    StringWriter rw
=new StringWriter();
                    HtmlTextWriter hw
=new HtmlTextWriter(rw);
                    
this.DataGrid1.RenderControl(hw);
                    Response.Write(rw.ToString());
                    Response.End();