New to Telerik Document ProcessingStart a free 30-day trial

Converts between ADO.NET DataTable instances and spreadsheet workbooks, enabling bidirectional data exchange for tabular data integration.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

C#
public class DataTableFormatProvider

Inheritance: objectDataTableFormatProvider

Constructors

Initializes a new instance of the DataTableFormatProvider class with default import and export settings.

C#
public DataTableFormatProvider()

Methods

Exports the specified worksheet to a new DataTable, converting cell values and types according to export settings.

C#
public DataTable Export(Worksheet worksheet, TimeSpan? timeout)
Parameters:worksheetWorksheet

The worksheet for export.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Returns:

DataTable

the converted DataTable

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Exports the specified worksheet to a new DataTable, converting cell values and types according to export settings.

C#
[Obsolete("This method is obsolete. Please use Export(Worksheet worksheet, TimeSpan? timeout) instead.")]
public DataTable Export(Worksheet worksheet)
Parameters:worksheetWorksheet

The worksheet for export.

Returns:

DataTable

the converted DataTable

Imports the specified DataTable into a new workbook, creating a worksheet with the table data.

C#
public Workbook Import(DataTable table, TimeSpan? timeout)
Parameters:tableDataTable

The DataTable for import.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Returns:

Workbook

the converted new Workbook.

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Imports the specified DataTable into an existing worksheet, appending data at the configured start position.

C#
public void Import(DataTable table, Worksheet worksheet, TimeSpan? timeout)
Parameters:tableDataTable

The DataTable for import.

worksheetWorksheet

The Worksheet where the data should be added.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Imports the specified DataTable into an existing worksheet, appending data at the configured start position.

C#
[Obsolete("This method is obsolete. Please use Import(DataTable table, Worksheet worksheet, TimeSpan? timeout) instead.")]
public void Import(DataTable table, Worksheet worksheet)
Parameters:tableDataTable

The DataTable for import.

worksheetWorksheet

The Worksheet where the data should be added.

Imports the specified DataTable into a new workbook, creating a worksheet with the table data.

C#
[Obsolete("This method is obsolete. Please use Import(DataTable table, TimeSpan? timeout) instead.")]
public Workbook Import(DataTable table)
Parameters:tableDataTable

The DataTable for import.

Returns:

Workbook

the converted new Workbook.

Properties

Gets or sets the settings controlling how worksheet data is exported to DataTable.

C#
public DataTableFormatProviderExportSettings ExportSettings { get; set; }

Gets or sets the settings controlling how DataTable data is imported into worksheets.

C#
public DataTableFormatProviderImportSettings ImportSettings { get; set; }