如何将asp.net MVC的详细视图数据导出到excel文件? [英] how to export asp.net MVC detail view data to an excel file?

查看:564
本文介绍了如何将asp.net MVC的详细视图数据导出到excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将ASP.NET MVC视图数据导出到Excel文件?
其实我的视图页面包含许多viewdata类型。
我正在使用这些数据类型的每个循环来在视图页面上显示数据。
我的要求是我要将显示的数据导出到Excel文件中。如何实现?

How to export ASP.NET MVC view data to an excel file ? Actually my view page contain many viewdata types. I am using for each loop with these datatype to displaying data on the view page. My requirement is that I want to export this displayed data into Excel file. How do I achieve this?

谢谢

推荐答案

a href =http://blogs.msdn.com/erikaehrli/archive/2009/01/30/how-to-export-data-to-excel-from-an-asp-net-application-avoid-the- file-format-different-prompt.aspxrel =nofollow noreferrer> http://blogs.msdn.com/erikaehrli/archive/2009/01/30/how-to-export-data-to-excel-from -an-ASP净应用避免最文件格式不同-prompt.aspx 。

Look at http://blogs.msdn.com/erikaehrli/archive/2009/01/30/how-to-export-data-to-excel-from-an-asp-net-application-avoid-the-file-format-differ-prompt.aspx.

经过一些实验,我使用Open XML SDK 2.0。您可以在 http:// msdn上找到很多信息.microsoft.com / en-us / office / aa905545.aspx http://openxmldeveloper.org/。另外还有一个链接 http://extrememl.codeplex.com/ 也是有用的。

After some experiments I use Open XML SDK 2.0. You can find currently a lot of information how to do this on http://msdn.microsoft.com/en-us/office/aa905545.aspx and http://openxmldeveloper.org/. One more link http://extrememl.codeplex.com/ can be also useful.

第一次使用Open XML SDK 2.0时,需要更多的时间作为其他方式,但导出的文件是真正的Excel文件和不能被用户转换 。如果您将对生成的excel文件的格式有更多的要求,那么您将可以在那里实施。

Usage of Open XML SDK 2.0 at the first time take a little more time as other ways, but exported files are real Excel files and should not be converted by users. And if you will be have more requirements for the format of produced excel files, you will be able to implement there.

这篇关于如何将asp.net MVC的详细视图数据导出到excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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