DataGrid导成Excel 的例子
来源:互联网 发布:中国医药价格数据分析 编辑:程序博客网 时间:2024/06/14 07:13
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
DataGrid dg = new DataGrid();
dg.DataSource = GetDataSource(); //返回DataSet或DataTable
dg.DataBind();
dg.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
如果导出有乱码:Response.ContentEncoding = System.Text.Encoding.UTF8
- DataGrid导成Excel 的例子
- DataGrid导成Excel 的例子
- DataGrid导出excel和word的例子
- DataGrid导出excel和word的例子
- 格式化DataGrid的例子
- DataGrid 过滤的例子
- datagrid的例子
- DataGrid右键菜单的例子
- Flex 简单的DataGrid 例子
- DATAGRID 导出EXCEL的方法
- Excel生成的例子!
- 操作Excel的例子
- 一个功能齐全的DataGrid分页例子
- 一个功能齐全的DataGrid分页例子
- 一个功能齐全的DataGrid分页例子
- 一个功能齐全的DataGrid分页例子
- 一个功能齐全的DataGrid分页例子
- 一个功能齐全的DataGrid分页例子
- 有多久没回来了?
- ASP.NET 2.0中Gridview控件高级技巧
- ID--HANDLE--HWND三者之间的互相转换
- java 练习题 输出组成整数的每个数字
- Ajax在用户注册上的简单应用
- DataGrid导成Excel 的例子
- IMapDocument.ReplaceContents(IMxdContents pObject)
- JS编码函数实例以及主要全局函数
- Div+CSS布局入门教程(转)
- HTML 语言教程——HTML标记一览(1)
- Asp.Net最新技术
- solaris x86 下装openq
- ASP防止网页频繁刷新的方法介绍
- (X)HTML初级教程