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

TableCollection.Add(Object, CellRange) Method

Creates a table from the specified range, adds it to the collection and binds it to the data source.

Namespace: DevExpress.Spreadsheet

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

Declaration

Table Add(
    object dataSource,
    CellRange range
)

Parameters

Name Type Description
dataSource Object

A data source object whose data should be retrieved in the worksheet.

range CellRange

A CellRange used to create a table.

Returns

Type Description
Table

A Table object that is the newly created table.

Remarks

The following rules are used, depending on the dimensions of the specified range:

Range Result
A single cell. A table is created to include all the data of the data source. It has the number of columns equal to the number of data fields, and the number of rows equal to the number of data rows in the data source. The top left corner of the table is the specified cell.
A range with a number of columns less than the number of data fields in the data source. An WorksheetDataBindingCollection.Error event occurs that indicates a column number mismatch. The table is not created.
A range with the number of columns equal to the number of data fields in the data source. A table is created with the number of rows equal to the number of data rows in the data source.
A range with a number of columns greater than the number of data fields in the data source A table is created that includes all columns from the data source and a number of empty columns to fill the entire range. The table has a number of rows equal to the number of data rows in the data source.
See Also