Nucleus .Net Core CMS

Excel.ExcelWriter<TModel> Class

Namespace: Nucleus.Extensions.Excel
Assembly: Nucleus.Extensions.dll
Class used to write (export) an Excel file from an IEnumerable of the class specified by TModel.
Type Parameters
TModel Type being exported.

Constructors

Nucleus.Extensions.Excel.ExcelWriter<TModel> Constructor

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

Nucleus.Extensions.Excel.ExcelWriter<TModel> Constructor

Nucleus.Extensions.Excel.ExcelWriter<TModel> (Modes mode, String[] properties)
Use this constructor to automatically set up columns.
Parameters
Name Type
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,Expression<TModel>) Method

AddColumn<TModel> (String name, String caption, XLDataType dataType, Expression<TModel> expression)
Add a column with an expression which is called to determine the output value.
Parameters
Name Type
name String
caption String
dataType ClosedXML.Excel.XLDataType
expression System.Linq.Expressions.Expression<TModel>

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

AddColumn<TModel> (String name, String caption, XLDataType dataType, Expression<TModel> expression)
Add a column with an expression which is called to determine the output value. This overload is for lambda expressions which do not reference the object being exported.
Parameters
Name Type
name String
caption String
dataType ClosedXML.Excel.XLDataType
expression System.Linq.Expressions.Expression<TModel>

Export (IEnumerable<TModel>) Method

Export (IEnumerable<TModel> items)
Automatically export items to the current worksheet.
Parameters
Name Type
items System.Collections.Generic.IEnumerable<TModel>