Table of Contents

Class DataColumnMapping

Namespace
OfficeOpenXml.Export.ToDataTable
Assembly
EPPlus.dll

Class used to map columns in the ToDataTable(ToDataTableOptions, DataTable) method

public class DataColumnMapping
Inheritance
DataColumnMapping
Inherited Members

Properties

AllowNull

Indicates whether empty cell values should be allowed. Corresponds to AllowDBNull

public bool AllowNull { get; set; }

Property Value

bool

ColumnDataType

Type of the column, corresponds to DataType

public Type ColumnDataType { get; set; }

Property Value

Type

DataColumn

The DataColumn used for the mapping

public DataColumn DataColumn { get; }

Property Value

DataColumn

DataColumnName

Name of the data column, corresponds to ColumnName

public string DataColumnName { get; set; }

Property Value

string

TransformCellValue

A function which allows casting of an object before it is written to the DataTable

public Func<object, object> TransformCellValue { get; set; }

Property Value

Func<object, object>

Examples

var options = ToDataTableOptions.Create(o =>
{
    // the last argument is a lambda function that will call the read value's ToString method
    // and this string will be written to the DataTable
    o.Mappings.Add(0, "Id", typeof(string), true, c => "Id: " + c.ToString());
});

ZeroBasedColumnIndexInRange

Zero based index of the mappings column in the range

public int ZeroBasedColumnIndexInRange { get; set; }

Property Value

int