Table.GetDataSource(RangeDataSourceOptions) Method
Creates the data source from the worksheet table using the specified options.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v26.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| options | RangeDataSourceOptions | A RangeDataSourceOptions object containing the data source options. |
Returns
| Type | Description |
|---|---|
| Object | An object that is the created data source. |
Remarks
The method also creates the WorksheetTableDataBinding object and adds it to the Worksheet.DataBindings collection.
Example
RangeDataSourceOptions options = new RangeDataSourceOptions();
Worksheet sheet = spreadsheetControl1.ActiveWorksheet;
Table sheetDataTable = sheet.Tables[0];
if (sheetDataTable.ShowHeaders)
options.UseFirstRowAsHeader = true;
else {
options.UseFirstRowAsHeader = false;
}
options.EditingOptions = DataSourceEditingOptions.ReadOnly;
options.SkipHiddenColumns = false;
rangeDS = sheetDataTable.GetDataSource(options);
sheet.DataBindings.Error += DataBindings_Error;
See Also