如何将数据从gridview导出到特定的Excel工作表。 [英] How to export data from gridview to a specific excel sheet.
本文介绍了如何将数据从gridview导出到特定的Excel工作表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于ASP.NET页面数据的gridview。我想将它导出到项目中存在的工作簿。
将数据放入其中我想将文件下载到本地机器。
希望我有意义..
I have a gridview with data on ASP.NET page. I want to export it to a workbook which is existed in project.
after putting data into it I want to download the file to local machine.
Hope i am making sense..
推荐答案
通过以下链接...
在ASP.NET中将Gridview数据导出到Excel [ ^ ]
http://www.aspdotnet- suresh.com/2011/04/how-to-export-gridview-data-to-excel-or.html [ ^ ]
以及下载使用以下代码
go through following link..
Export Gridview Data to Excel in ASP.NET[^]
http://www.aspdotnet-suresh.com/2011/04/how-to-export-gridview-data-to-excel-or.html[^]
and for download use following code
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=nameOfExcelFile.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(FileFullPath, true);//get FileFullPath by server.MapPath which u have created
Response.Flush();
Response.End();
这篇关于如何将数据从gridview导出到特定的Excel工作表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文