Skip to main content
Row

WorksheetExtensions.CreateDataTableExporter(Worksheet, CellRange, DataTable, Boolean) Method

Creates an instance of the data table exporter.

You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this method in production code.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Docs.v23.2.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public static DataTableExporter CreateDataTableExporter(
    this Worksheet sheet,
    CellRange range,
    DataTable dataTable,
    bool rangeHasHeaders
)

Parameters

Name Type Description
sheet Worksheet

A Worksheet interface for the worksheet which contains data for export.

range CellRange

A CellRange of cells containing data for export.

dataTable DataTable

A DataTable object which will be populated with exported data.

rangeHasHeaders Boolean

true, to skip the first row in the specified range; otherwise, false.

Returns

Type Description
DataTableExporter

A DataTableExporter instance that performs export to a data table.

Remarks

Use the CreateDataTableExporter method to create a DataTableExporter which is the key object of the data export.

Note

When calling the CreateDataTableExporter method, make sure that the number of data columns in the specified dataTable is the same as the number of columns in the specified range; otherwise, a System.ArgumentException will be thrown.

Therefore, if you need to add an additional column to the data table (e.g., an auto-incremented or computed column), you should do it only after DataTableExporter is created.

Use the WorksheetExtensions.CreateDataTable method to create a data table that corresponds to the specified worksheet cell range.

See Also