Class ToDataTableOptions
- Namespace
- OfficeOpenXml.Export.ToDataTable
- Assembly
- EPPlus.dll
This class contains options for the ToDataTable method of ExcelRangeBase.
public class ToDataTableOptions
- Inheritance
-
ToDataTableOptions
- Inherited Members
Properties
AlwaysAllowNull
If true, the AllowNull will be overridden and null values will be allowed in all columns.
public bool AlwaysAllowNull { get; set; }
Property Value
ColumnNameParsingStrategy
NameParsingStrategy to use when parsing the first row of the range to column names
public NameParsingStrategy ColumnNameParsingStrategy { get; set; }
Property Value
ColumnNamePrefix
If no column names are specified, this prefix will be used followed by a number
public string ColumnNamePrefix { get; set; }
Property Value
DataIsTransposed
Set to true if the worksheet is contains transposed data.
public bool DataIsTransposed { get; set; }
Property Value
DataTableName
Name of the data table
public string DataTableName { get; set; }
Property Value
DataTableNamespace
Namespace of the data table
public string DataTableNamespace { get; set; }
Property Value
EmptyRowStrategy
Sets how empty rows in the range are handled when detected
public EmptyRowsStrategy EmptyRowStrategy { get; set; }
Property Value
ExcelErrorParsingStrategy
Sets how Excel error values are handled when detected.
public ExcelErrorParsingStrategy ExcelErrorParsingStrategy { get; set; }
Property Value
FirstRowIsColumnNames
If true, the first row of the range will be used to collect the column names of the DataTable. The column names will be set according to the ColumnNameParsingStrategy used.
public bool FirstRowIsColumnNames { get; set; }
Property Value
Mappings
Mappings that specifies columns from the range and how these should be mapped to the DataTable
public DataColumnMappingCollection Mappings { get; }
Property Value
- See Also
PredefinedMappingsOnly
If true, only columns that are specified in the Mappings collection are included in the DataTable.
public bool PredefinedMappingsOnly { get; set; }
Property Value
SkipNumberOfRowsEnd
Number of rows that will be skipped from the end (bottom) of the range.
public int SkipNumberOfRowsEnd { get; set; }
Property Value
SkipNumberOfRowsStart
Number of rows that will be skipped from the start (top) of the range. If FirstRowIsColumnNames is true, this will be applied after the first row (column names) has been read.
public int SkipNumberOfRowsStart { get; set; }
Property Value
Methods
Create()
Creates an instance of ToDataTableOptions with default values set.
public static ToDataTableOptions Create()
Returns
- See Also
-
OfficeOpenXml.Export.ToDataTable.ToDataTableOptions.Default
Create(Action<ToDataTableOptions>)
Creates an instance of ToDataTableOptions. Use the configHandler
parameter to set the values on it.
public static ToDataTableOptions Create(Action<ToDataTableOptions> configHandler)
Parameters
configHandler
Action<ToDataTableOptions>Use this to configure the ToDataTableOptions instance in a lambda expression body.
Returns
- ToDataTableOptions
The configured ToDataTableOptions
SetPrimaryKey(params int[])
Sets the primary key of the data table.
public void SetPrimaryKey(params int[] zeroBasedRangeIndexes)
Parameters
zeroBasedRangeIndexes
int[]The index or indexes of one or more column in the range that builds up the primary key of the DataTable
SetPrimaryKey(params string[])
Sets the primary key of the data table.
public void SetPrimaryKey(params string[] columnNames)