.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

CsvDocumentImporterOptions.ColumnTypes Property

Provides access to the object which enables you to specify the data types for columns in an imported document.

Namespace: DevExpress.XtraSpreadsheet.Import

Assembly: DevExpress.Spreadsheet.v21.2.Core.dll


public override ColumnDataTypeCollection ColumnTypes { get; }

Property Value

Type Description

A ColumnDataTypeCollection object that stores data format settings for columns in the imported document.

Property Paths

You can access this nested property as listed below:

Object Type Path to ColumnTypes


The ColumnTypes property allows you to define the data format for specific columns in the imported CSV file. This property gets access to the ColumnDataTypeCollection collection, which provides a mapping from a set of document columns to a set of column data formats. Use the ColumnDataTypeCollection.Item property to specify a data type for a particular column in the imported document. Note that the column data format settings are taken into account only if the CsvDocumentImporterOptions.ValueTypeDetectMode property is set to CsvValueTypeDetectMode.Advanced.

The following example demonstrates how to specify a data type for the first column of the CSV document being loaded into the SpreadsheetControl.

private void SpreadsheetControl_BeforeImport(object sender, SpreadsheetBeforeImportEventArgs e)
    if (e.DocumentFormat == DocumentFormat.Csv)
        DevExpress.XtraSpreadsheet.Import.CsvDocumentImporterOptions options = (DevExpress.XtraSpreadsheet.Import.CsvDocumentImporterOptions)e.Options;
        // Specify the data format for the first column in the imported document.
        options.ColumnTypes[0] = DevExpress.XtraSpreadsheet.Import.ColumnDataType.Text;
See Also