Show / Hide Table of Contents

Class DataColumnMapping

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

Inheritance
System.Object
DataColumnMapping
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: OfficeOpenXml.Export.ToDataTable
Assembly: EPPlus.dll
Syntax
public class DataColumnMapping

Properties

AllowNull

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

Declaration
public bool AllowNull { get; set; }
Property Value
Type Description
System.Boolean

ColumnDataType

System.Type of the column, corresponds to System.Data.DataColumn.DataType

Declaration
public Type ColumnDataType { get; set; }
Property Value
Type Description
System.Type

DataColumn

The System.Data.DataColumn used for the mapping

Declaration
public DataColumn DataColumn { get; }
Property Value
Type Description
System.Data.DataColumn

DataColumnName

Name of the data column, corresponds to System.Data.DataColumn.ColumnName

Declaration
public string DataColumnName { get; set; }
Property Value
Type Description
System.String

TransformCellValue

A function which allows casting of an System.Object before it is written to the System.Data.DataTable

Declaration
public Func<object, object> TransformCellValue { get; set; }
Property Value
Type Description
System.Func<System.Object, System.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

Declaration
public int ZeroBasedColumnIndexInRange { get; set; }
Property Value
Type Description
System.Int32
In This Article
Back to top Generated by DocFX