Nucleus .Net Core CMS

Excel.ExcelReader<TModel> Class

Namespace: Nucleus.Extensions.Excel
Assembly: Nucleus.Extensions.dll
Class used to read Excel files into an IEnumerable of the class specified by TModel.
Type Parameters
TModel Type being imported.

Constructors

Nucleus.Extensions.Excel.ExcelReader<TModel> Constructor

Nucleus.Extensions.Excel.ExcelReader<TModel> (System.IO.Stream)
Use this constructor if you want to set up columns manually using the AddColumn method.

Nucleus.Extensions.Excel.ExcelReader<TModel> Constructor

Nucleus.Extensions.Excel.ExcelReader<TModel> (Stream input, Modes mode, String[] properties)
Use this constructor to automatically set up columns.
Parameters
Name Type
input System.IO.Stream
mode Nucleus.Extensions.Excel.ExcelWorksheet.Modes

Specifies whether to include or exclude the properties in the properies argument.

properties String[]
Remarks
When mode is AutoDetect, all properties of TModel are automatically included in the output, except for those listed in properties. When mode is IncludeSpecifiedPropertiesOnly, only the properties listed in properties are included in the output.

Methods

AddColumn<TModel> (Expression<TModel>) Method

AddColumn<TModel> (Expression<TModel> expression)
Add a column using an expression to specify the column.
Parameters
Name Type
expression System.Linq.Expressions.Expression<TModel>

AddColumn<TModel> (String,String,XLDataType,Action<TModel>) Method

AddColumn<TModel> (String name, String caption, XLDataType dataType, Action<TModel> expression)
Add a column with an expression which is called to set the input value.
Parameters
Name Type
name String
caption String
dataType ClosedXML.Excel.XLDataType
expression Action<TModel>

Import

Import ()
Automatically read items from the current worksheet.