asp net core export to Excel

China☆狼群 提交于 2019-12-18 15:32:56

问题


I'm not sure that this kind of question can be posted here, but I think that it might be interested to many programmers. I need a package that would provide me with an interface for creating Excel files. I looked up on nuget and found several packages, but not a single one that supports asp net core.


回答1:


Please find Open XML SDK.

I'm using v2.5 with ASP.NET Core + .NET4.6, but as far I know the latest version v2.7 has added support for .NET Standard 1.3 - please read the change log.


More info:

  • Where to get the NuGet package
  • Documentation
  • Open XML SDK 2.5 for Office
  • Official releases of the NuGet packages for the Open XML SDK



回答2:


Little bit of thread necromancy here; however I wanted to share some other options that I found for any of the other search explorers out there.

ClosedXML

  • Uses AlphaNumeric Cell navigation e.g. ws.Cell("B2").Value = "Contacts";
  • Has a large amount of documentation and How To's
  • This is only for excel spreadsheets and does not have support for other Microsoft file types.
  • To install use PM> Install-Package ClosedXML

NPOI

  • Uses Numeric Cell navigation e.g.

    var rowIndex = 0; IRow row = sheet1.CreateRow(rowIndex); row.Height = 30 * 80; row.CreateCell(0).SetCellValue("this is content");

  • Supports read/write for xls, doc, ppt files.
  • To install use nuget: Install-Package DotNetCore.NPOI

EPPlus.Core

  • This is an unofficial port of the EPPlus Library to .NET Core.

somewhat relevant:

Datatables.net

I need a package that would provide me with an interface for creating Excel files.

I am not certain if you are displaying this data and are looking for a way to export it to excel but this could be an option as well if you are attempting to allow this in either an admin or public view. There are options available for customizing the output via a callback if the default output is undesirable.

  • DOM Structure documentation
  • Export Buttons
  • Excluding Specific Columns
  • Customization of Excel Export



回答3:


GrapeCity Document API for Excel supports .NET core 2.0+ (cross platform) very well, and you can try: https://www.grapecity.com/documents-api-excel

API is VSTO style and pretty straightforward:

Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.Worksheets[0];


来源:https://stackoverflow.com/questions/42296769/asp-net-core-export-to-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!