我如何在gridview中导出特定的列,而不是导出整个gridview? [英] How can i export specific columns in gridview instead of exporting the whole gridview?
本文介绍了我如何在gridview中导出特定的列,而不是导出整个gridview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!全部
如何在gridview中导出特定的列,而不是导出整个gridview.
以下是我编写的正常代码,可以正常工作,但是我想导出一些有限的列.
请帮帮我
以下是我的代码,效果很好:
Hi! all
How can i export specific columns in gridview instead of exporting the whole gridview.
Following is the normal code i''ve written which works fine, but i want to export some limited number of columns.
Please help me out
Following is my code which works fine:
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Untitled.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving then
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
worklistGridView.RenderControl(htmlWriter);
Response.Write(stringWriter.ToString());
Response.End();
推荐答案
[
The first hit from a google search with: ''export gridview columns to excel''[^]. Google is your friend! :)
此链接将帮助ytou
http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html [ ^ ]
this link will help ytou
http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html[^]
这篇关于我如何在gridview中导出特定的列,而不是导出整个gridview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文