Method ExportObjects
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
ExportObjects<T>(XlsxCellRange?, XlsxExportOptions?)
Reads a range into objects: one for each row under the headings, each heading's column going to the public settable property of that name.
public IReadOnlyList<T> ExportObjects<T>(XlsxCellRange? range = null, XlsxExportOptions? options = null) where T : new()
Parameters
rangeXlsxCellRange?The range, or null for every cell the sheet stores. Its first row holds the headings.
optionsXlsxExportOptionsThe options, or null for the defaults.
Returns
- IReadOnlyList<T>
The objects, in the order of the rows.
Type Parameters
TThe type to create for each row. Its properties are found once and kept for the type.
Remarks
A heading is matched to a property without regard to case. The columns may be in any
order; a heading no property has is skipped, and a property no heading names keeps the
value its constructor gave it, as it does where the cell is empty. A cell that cannot be
given as the property's type is reported in Issues and
the property is left as it was: a whole number is not made from 4.5, and a number
is not made from text.
Exceptions
- ArgumentException
FirstRowIsHeader is false: a property is found by its heading.
- ResourceLimitExceededException
The range covers more cells than MaxCells.
- InvalidDocumentException
The sheet's part is malformed; or Strict is set and a cell could not be given.