GenericExporter is a generic excel exporter for collection of any strong typed objects. GenericExporter uses reflecton to get property name as header in the output file. But you can also provide optional parameters for custom headers and even formatters.
Install-Package GenericExporter
- Add dependency injection in Startup:
services.AddGenericExporter();
- Call export function:
var items=new List<User>(new User{...});
var result = _exporter.Export(items);
- Otional parameters for custom headers and formatters:
var items=new List<User>(new User{...});
var result = _exporter.Export(items,new[] {"Id","Full Name","Birthday"},x=>new[] {x.Id,x.Name,x.Birthday.ToShortDateString()});
All source code is licensed under MIT license - http://www.opensource.org/licenses/mit-license.php