Nucleus .Net Core CMS

ExcelWriter Class

Namespace: Nucleus.Extensions
Assembly: Nucleus.Extensions.dll
Non-generic exporter.

Constructors

Nucleus.Extensions.ExcelWriter Constructor

Nucleus.Extensions.ExcelWriter ()
Constructor, used by the generic ExcelWriter<T> class.

Nucleus.Extensions.ExcelWriter Constructor

Nucleus.Extensions.ExcelWriter (IXLWorksheet worksheet)
Use this constructor if you want to create columns and output rows manually. The generic ExcelWriter<TModel> class can auto-detect columns.
Parameters
Name Type
worksheet ClosedXML.Excel.IXLWorksheet

Properties

Workbook Property

Excel workbook being created.

Worksheet Property

Excel worksheet being created.
Remarks
Callers can create multiple worksheets by calling WorkBook.WorkSheets.Add.

WorksheetColumns Property

List of worksheet columns.

RowIndex Property

Current row index.

Methods

GetOutputStream

GetOutputStream ()
Return the spreadsheet as a stream.

AddColumn (PropertyInfo) Method

AddColumn (PropertyInfo propertyInfo)
Add a column and auto-detect values using reflection.
Parameters
Name Type
propertyInfo System.Reflection.PropertyInfo

AddColumn (String,String,XLDataType) Method

AddColumn (String name, String caption, XLDataType dataType)
Add a column.
Parameters
Name Type
name String
caption String
dataType ClosedXML.Excel.XLDataType

RemoveColumn (String) Method

RemoveColumn (String name)
Remove the specified column column.
Parameters
Name Type
name String

WriteHeadingRow

WriteHeadingRow ()
Write the heading row.

WriteRow (Object[]) Method

WriteRow (Object[] values)
Write the specified values to the next row of the current worksheet.
Parameters
Name Type
values Object[]

WriteRow (IEnumerable<Object>) Method

WriteRow (IEnumerable<Object> values)
Write the specified values to the next row of the current worksheet.
Parameters
Name Type
values System.Collections.Generic.IEnumerable<System.Object>

ListToString (IList) Method

ListToString (IList value)
Convert a list of items to a comma-separated string.
Parameters
Name Type
value System.Collections.IList

AdjustColumnWidths

AdjustColumnWidths ()
Automatically expand column widths to fit content.

GetXLDataType (Type) Method

GetXLDataType (Type type)
Return the spreadsheet data type which matches the specified type
Parameters
Name Type
type Type