asp.net导出EXCEL的功能代码
实现代码如下://由gridviw导出为Excel public static void ToExcel(System.Web.UI.Control ctl) { HttpContext.Current.Response.AppendHeader("Content-Disposition", "at
实现代码如下://由gridviw导出为Excel public static void ToExcel(System.Web.UI.Control ctl) { HttpContext.Current.Response.AppendHeader("Content-Disposition", "at
前些时间有朋友为了完成此功能,就硬把数据导入DataGrid再导出到Excel。这实在是多此一举。 解决办法: 通过Linq将数据读出,并直接写入数据流中 代码如下: 实现代码如下:public partial class DataToExcel : System.Web.UI.Page { pro