将数据(从gridview或datatable)导出到excel并下载它的最简单方便的方法是什么 [英] What is the easiest and convenient way to export data (from gridview or datatable) to excel and download it

查看:83
本文介绍了将数据(从gridview或datatable)导出到excel并下载它的最简单方便的方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我正在开发一个程序,需要将数据(从gridview或datatable,无论哪个好)导出到MS Excel。



除此之外,我们还有其他选择:

1.使用ExcelInterop,因为它需要在服务器中安装MS Office Excel,否则会提示错误

2. StreamWriter因为这会将gridview呈现为HTML并打印整个页面而不是单独的控件。它也不支持.xlsx文件。

2. OpenXML



我一直在寻找解决方案,但似乎没有得到一个。

谢谢,您的建议将受到高度赞赏!

Hi. I am developing a program that needs to export data (either from gridview or datatable whichever is good) to MS Excel.

Aside from these, do we have other option:
1. Use of ExcelInterop since it needs MS Office Excel to be installed in the server, or else it will prompt error
2. StreamWriter as this renders the gridview as HTML and prints the whole page instead of the control alone. It also does not support .xlsx file.
2. OpenXML

I've been trying to look for solution but doesnt seem to get one.
Thanks, Your suggestions will be highly appreciated!

推荐答案

您好,请参考,

1 。 http:// www .aspsnippets.com / Articles / Export-GridView-to-Excel-in-ASPNet-with-Formatting-using-C-and-VBNet.aspx [ ^ ] br />
2. 将Gridview数据导出到Excel中ASP.NET [ ^ ]

3. http://www.c-sharpcorner.com/UploadFile/DipalChoksi/ExportASPNetDataGridToExcel11222005041447AM/ExportASPNetDataGridToExcel.aspx [< a href =http://www.c-sharpcorner.com/UploadFile/DipalChoksi/ExportASPNetDataGridToExcel11222005041447AM/ExportASPNetDataGridToExcel.aspx\"target =_ blanktitle =New Window> ^ ]
Hi, refer this,
1. http://www.aspsnippets.com/Articles/Export-GridView-to-Excel-in-ASPNet-with-Formatting-using-C-and-VBNet.aspx[^]
2. Export Gridview Data to Excel in ASP.NET[^]
3. http://www.c-sharpcorner.com/UploadFile/DipalChoksi/ExportASPNetDataGridToExcel11222005041447AM/ExportASPNetDataGridToExcel.aspx[^]


这篇关于将数据(从gridview或datatable)导出到excel并下载它的最简单方便的方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆