从ASP.NET将表格数据导出到Excel

There's a number of ways to "export" data to Excel from an ASP.NET site - some more elegant than others.

有多种方法可以将数据从ASP.NET站点“导出”到Excel,其中有些方法比其他方法更优雅。

  • Gross: You can use ASP.NET to generate a CSV file of Mime Type text/plain or text/csv and write it back to the browser.

    毛重:您可以使用ASP.NET生成Mime类型为text / plain或text / csv的CSV文件,并将其写回到浏览器。

  • NOT Gross: You can use ASP.NET to generate an XML-SS (Excel XML Spreadsheet) document and write it back to the browser.

    无需花钱:您可以使用ASP.NET生成XML-SS ( Excel XML电子表格)文档并将其写回到浏览器中。

  • Really Easy but not Really XMLy: You can take advantage of the ASP.NET DataGrid's ability to generate HTML tables quickly and return the page with a Mime Type of application/vnd.ms-excel.  Here's a great example on how to create these reports

    真的很简单,但不是真正的XMLy:您可以利用ASP.NET DataGrid的功能来快速生成HTML表,并使用Mime Type of application / vnd.ms-excel返回页面。 这是有关如何创建这些报告的绝佳示例。

  • Easy but uses 3rd Party Control: Use ExcelWriter on the server side to create the Report.

    容易,但使用第三方控制:在服务器端使用ExcelWriter创建报告。

  • Disgusting: Automate Excel on the ServerSideDon't do this for Pete's Sake.

    令人作呕:在ServerSide上自动执行Excel不要为皮特的清酒做这个。

翻译自: https://www.hanselman.com/blog/exporting-tabular-data-to-excel-from-aspnet

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值