New to Telerik Document ProcessingStart a free 30-day trial

Import Settings

Updated on Apr 24, 2026
  • PreferredDateTimeFormat: This property gets or sets the default format string when importing DateTime columns.
  • ShouldImportColumnHeaders: Controls whether the column headers should be imported.
  • StartCellIndex: Gets or sets the index where the table should start in the Worksheet.

The CellImported event

The CellImported event is fired for each cell and allows you to change the cell properties.

The CellImportedEventArgs contains information about the current cell:

  • dataTableRowIndex: The index of the row in the DataTable containing the cell for which the event occurs.
  • dataTableColumnIndex: The index of the column in the DataTable containing the cell for which the event occurs.
  • worksheetRowIndex: The index of the row in the Worksheet containing the cell for which the event occurs.
  • worksheetColumnIndex: The index of the column in the Worksheet containing the cell that the event occurs for.
  • worksheet: The worksheet where the data is imported.

Example 1: Using the CellImported event to format the cells

C#
DataTable table = GetTable();
DataTableFormatProvider provider = new DataTableFormatProvider();
provider.ImportSettings.CellImported += (s, e) =>
{
    if (e.DataTableColumnIndex == 1 && e.WorksheetRowIndex > 1)
    {
        e.Worksheet.Cells[e.WorksheetRowIndex, e.WorksheetColumnIndex].SetForeColor(new ThemableColor(Colors.Red));
    }
};

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();

provider.Import(table, worksheet, TimeSpan.FromSeconds(10));

radSpreadsheet.Workbook = workbook;

Export Settings

  • HasHeaderRow: Gets or sets whether the header row of the worksheet should be exported.
  • ShouldSetDataTypes: Gets or sets whether the exporter should try to parse the data types from the spreadsheet. If false, only objects will be exported.
  • DataTableCulture: Gets or sets the DataTable culture. By default, the culture of the workbook is used.
  • RangeToExport: Gets or sets the cell range for which the data will be exported.

The ColumnExporting event

The ColumnExporting event is fired for each column before the column is added to the table and allows you to change its properties.

The ColumnExportingEventArgs object contains the current column instance and its index:

  • DataColumn: Gets the DataColumn that is being exported.
  • ColumnIndex: Gets the index of the exported column.

Example 2: Using the ColumnExporting event to set the AllowDBNull property

C#
DataTableFormatProvider provider = new DataTableFormatProvider();
provider.ExportSettings.ColumnExporting += (s, e) =>
{
    if (e.ColumnIndex == 3)
    {
        e.DataColumn.AllowDBNull = true;
    }
};
var table = provider.Export(radSpreadsheet.Workbook.ActiveWorksheet, TimeSpan.FromSeconds(10));

See Also