C# – How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?


Oglasi

You can use a library called ExcelLibrary. It’s a free, open source library posted on Google Code:

ExcelLibrary

This looks to be a port of the PHP ExcelWriter that you mentioned above. It will not write to the new .xlsx format yet, but they are working on adding that functionality in.

Oglasi

It’s very simple, small and easy to use. Plus it has a DataSetHelper that lets you use DataSets and DataTables to easily work with Excel data.

ExcelLibrary seems to still only work for the older Excel format (.xls files), but may be adding support in the future for newer 2007/2010 formats.

You can also use EPPlus, which works only for Excel 2007/2010 format files (.xlsx files). There’s also NPOI which works with both.

There are a few known bugs with each library as noted in the comments. In all, EPPlus seems to be the best choice as time goes on. It seems to be more actively updated and documented as well.

Oglasi

Also, as noted by @АртёмЦарионов below, EPPlus has support for Pivot Tables and ExcelLibrary may have some support (Pivot table issue in ExcelLibrary)

Oglasi

Here are a couple links for quick reference:
ExcelLibrary – GNU Lesser GPL
EPPlus – GNU (LGPL) – No longer maintained
EPPlus 5 – Polyform Noncommercial – Starting May 2020
NPOI – Apache License

Oglasi

What Is a Web Application?
Web applications are programs allowing better communication between businesses and their customers. …
How much can I earn from Google Adsense?
Google AdSense is a Google program that allows publishers to monetize their …

Blog at WordPress.com.

%d blogeri kao ovaj: