Switch branches/tags
Nothing to show
Clone or download
majimenezp Merge pull request #2 from varchar66/master
Latest version NPOI update
Latest commit e3d3b21 Feb 9, 2015
Failed to load latest commit information.
SimpleExcelExport No commit message Jul 30, 2014
Tests No commit message Jul 30, 2014
.gitignore First version May 2, 2012 Update Jul 30, 2014
SimpleExcelExport.sln Header format options added Nov 3, 2012


SimpleExcelExport it is a small library to export to excel(using NPOI) a list of objects in your program, in order to add export capabilities to your application in a short time.

I already using in some projects, and maybe you can give a try if have a lot of modules where you need to exporte some data to excel.

Soon i will to upload in nuget for a easy install.

##Install With nuget:

  • Install-Package SimpleExcelExport



  • NPOI

##How to use

  • Add the reference in your project.

  • Create a list of object an populate.

     var persons = new List<Person>();
  • Pass the list to SimpleExcelExport:

    var result = SimpleExcelExport.ExportToExcel().ListToExcel(persons);

  • (Optional) return file from web controller:

    return File(result, "application/", "Report.xls");

  • The library return the generated excel as a byte array.

##Column names and columns order The columns names and order by default are the property name and alphabetical order, if you want to set a custom name for the columns and order, you need to add an attribute to your properties in your POCO class, for example:

[ExcelExport("Last Name", order = 2,HFontBold=true,HFontColor ="White",HBackColor="Red")]
    public string LastName { get; set; }

    [ExcelExport("day of birth", order = 3)]
    public DateTime BirthDay { get; set; }

Where you set the column name with the first parameter and the column order with the named parameter "order". Also(thanks to @rivuc) you can define font weight(bold), cell background color and font(foreground) color.

Any comment or idea for a new feature(or even better to send a pull request) contact me at: twitter: @majimenezp