GridView 分页模式下导出所有记录至Excel
来源:互联网 发布:spss软件免费中文版 编辑:程序博客网 时间:2024/04/28 06:54
if (GV_qkcj.Rows.Count > 0)
{
GV_qkcj.AllowPaging = false;
BindQK();
foreach (GridViewRow dg in this.GV_qkcj.Rows)
{
dg.Cells[0].Attributes.Add("style", "vnd.ms-excel.numberformat: @;");
dg.Cells[1].Attributes.Add("style", "vnd.ms-excel.numberformat: @;");
}
Response.Clear();
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("_yyyyMMdd_HHmmss") + ".xls");
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GV_qkcj.RenderControl(htw);
Response.Write(sw.ToString());
Response.Flush();
Response.End();
GV_qkcj.AllowPaging = true;
BindQK();
}
else
{
Response.Write("没有数据");
}
{
GV_qkcj.AllowPaging = false;
BindQK();
foreach (GridViewRow dg in this.GV_qkcj.Rows)
{
dg.Cells[0].Attributes.Add("style", "vnd.ms-excel.numberformat: @;");
dg.Cells[1].Attributes.Add("style", "vnd.ms-excel.numberformat: @;");
}
Response.Clear();
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("_yyyyMMdd_HHmmss") + ".xls");
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GV_qkcj.RenderControl(htw);
Response.Write(sw.ToString());
Response.Flush();
Response.End();
GV_qkcj.AllowPaging = true;
BindQK();
}
else
{
Response.Write("没有数据");
}
0 0
- GridView 分页模式下导出所有记录至Excel
- GridView 分页导出Excel
- GridView导出至EXCEL
- 不需要安装office excel,导出GridView所有数据为Excel
- 设计能够导出所有记录到excel的分页(使用AspNetPager)页面,并解决excel文件名中文乱码问题
- IE下GridView导出Excel无反应
- GridView如何将分页数据全部导出为EXCEL
- GridView导出Excel操作(有分页基础上)
- 【ASP.NET】Aspnetpager对GridView分页,并导出Excel
- Gridview导出excel当前页与所有页的方法!
- GridView导出到Excel(可选择记录条数)
- GridView导出到Excel(可选择记录条数)
- Silverlight 中将DataGrid中所有分页导出到Excel
- Gridview导出到Excel,Gridview中的各类控件,Gridview中删除记录的处理
- Gridview导出到Excel,Gridview中的各类控件,Gridview中删除记录的处理
- .Net GridView 应用:Gridview有一个CheckBox列,在用了分页的情况下,如何取出用户选择的所有记录id
- GridView导出Excel研究
- GridView导出Excel研究
- 【栈】 删数游戏
- A Feature Descriptor: Shape Context
- AJAX基础
- ubuntu14/ubuntu16/centos7:解决可以ping ip却ping不通主机名
- 异常处理得出的结论
- GridView 分页模式下导出所有记录至Excel
- 懂得取舍,方成大事
- React Native手势处理详解
- 关于动漫管理项目的一些思考
- 整数进行任意进制转换
- 深入浅出的理解框架(Struts2、Hibernate、Spring)与 MVC 设计模式
- angularjs的$http.post和$http.get的使用
- 学校的统一订书80%该烧掉——IT推荐书单
- (HDU1166)敌兵布阵(A)