Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

ColumnDataTypeCollection.Item[Int32] Property

Gets or sets the data type of a specific column in the imported text document.

Namespace: DevExpress.XtraSpreadsheet.Import

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

public ColumnDataType this[int columnIndex] { get; set; }

Parameters

Name Type Description
columnIndex Int32

A zero-based index of the column in the imported document whose data type should be set or obtained.

Property Value

Type Description
ColumnDataType

A ColumnDataType enumeration value which defines the data type of the specified column.

Remarks

The following example demonstrates how to use the Item property of the ColumnDataTypeCollection collection (accessible from the CsvDocumentImporterOptions.ColumnTypes property) to specify a data type of the first column in a 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