C# Class ExcelExtensions, code

Show file Open project: shendongnian/code Class Usage Examples

Public Methods

Method Description
GetAttributeFrom ( object instance, string propertyName ) : T,

Get's an attribute from any given property

GetDownload ( NPOI.HSSF.UserModel.HSSFWorkbook file, string fileName ) : FileStreamResult,

Converts the NPOI workbook into a byte array for download

ToExcel ( IEnumerable, rows, string sheetName ) : FileStreamResult,

Creates an Excel document from any IEnumerable returns a memory stream

Method Details

GetAttributeFrom() public static method

Get's an attribute from any given property
public static GetAttributeFrom ( object instance, string propertyName ) : T,
instance object
propertyName string
return T,

GetDownload() public static method

Converts the NPOI workbook into a byte array for download
public static GetDownload ( NPOI.HSSF.UserModel.HSSFWorkbook file, string fileName ) : FileStreamResult,
file NPOI.HSSF.UserModel.HSSFWorkbook
fileName string
return FileStreamResult,

ToExcel() public static method

Creates an Excel document from any IEnumerable returns a memory stream
public static ToExcel ( IEnumerable, rows, string sheetName ) : FileStreamResult,
rows IEnumerable, IEnumerable that will be converted into an Excel worksheet
sheetName string Name of the Ecel Sheet
return FileStreamResult,