在ASP.net程序中如何才能让报表能够导出到Excel文件中? 用什么方式,怎么来写代码才能够把报表导出到Excel文件中,请各位大虾指点一二~~~!谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.Web.UI.Control ctl=this.DataGrid1;//DataGrid1是你在窗体中拖放的控件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(); 求一个visual sourcesafe6.0 下载的地址 LDAP 开发中碰到一个问题。希望牛人的出现 帮我解决 无法在vs2010后台调用label控件 上传视频格式判断方法 如何解决back()或go(-1) 时 页面过期的问题? asp.net中用Request.QueryString不能传值 局域网中Web服务器防火墙(XP SP2 自带防火墙)的设置 大家都来讨论! 谁能给我windows IE TreeView的组件包? 一个很菜的问题:为打开的页面加背景音乐? 教我学sqlparameter 求asp.net(C#)制作论坛
//DataGrid1是你在窗体中拖放的控件
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();