Skip to content

๐Ÿ“‹ Convert any IEnumerable in .NET to an Excel sheet.

License

Notifications You must be signed in to change notification settings

dimesoftware/excelist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Excelist


Simple library to convert `IEnumerable` to an Excel sheet.

About the project

The purpose of this project is to detach the implementation of Excel libraries from its contracts. This is particularly useful in an era where it is uncertain that a project will be maintained and will be migrated to .NET Core and .NET 5.

This project then does not introduce any new capabilities. It is merely a generic wrapper that allows you to inject dependencies into your code base and should give you peace of mind that your investments in your code are safe and should not be impacted if you decide to change Excel export libraries, for whatever reason that may be.

Installation

Use the package manager NuGet to install the base library of Excelist:

dotnet add package Excelist

Next it is up to you to decide which implementations you want to use:

Implementation Command
OpenXml dotnet add package Excelist.OpenXml

To speed up the development cycle, there are extension methods at your disposal:

Extension Command
System.Net.Http dotnet add package Excelist.Http

Usage

The center of this project is the IEnumerableToExcelConverter<in T> interface. The implementations are hidden away through this interface, and as such, can be swapped effortlessly for another implementation.

For example, in a good old ASP.NET Web API project, you can use the Excelist.Http library to return an Excel file as a response:

public class LogsApiController : ApiController
{
    [HttpGet]
    [Route("LogDumpFile")]
    public async t.Task<HttpResponseMessage> GetDump(int limit, string sort, string filter)
    {
        IPage<LogDto> records = await Service.GetAsync(1, limit, 1, sort, filter);
        return Request.ExportToExcel(records.Data, new OpenOfficeEnumerableToExcelConverter<LogDto>());
    }
}

Contributing

PRs Welcome

Pull requests are welcome. Please check out the contribution and code of conduct guidelines.

About

๐Ÿ“‹ Convert any IEnumerable in .NET to an Excel sheet.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages