Skip to main content
All docs
V19.1
.NET Framework 4.5.2+
Row

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

Creates an instance of the data table exporter.

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

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Docs.v19.1.dll

Declaration

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

Parameters

Name Type Description
sheet Worksheet

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

range Range

A Range 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