Back to Devexpress

RangeDataSourceOptions Class

officefileapi-devexpress-dot-spreadsheet-0b03d1a0.md

latest2.7 KB
Original Source

RangeDataSourceOptions Class

Contains various options for a data source created from a cell range.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public class RangeDataSourceOptions :
    DataSourceOptionsBase
vb
Public Class RangeDataSourceOptions
    Inherits DataSourceOptionsBase

Remarks

A RangeDataSourceOptions object is created and passed as a parameter to the CellRange.GetDataSource or the WorksheetDataBindingCollection.CreateDataSource methods.

Example

View Example

csharp
RangeDataSourceOptions options = new RangeDataSourceOptions();
Worksheet sheet = spreadsheetControl1.ActiveWorksheet;
CellRange dataRange = sheet.Selection;
if (dataRange.Equals(sheet.Tables[0].Range))
    options.UseFirstRowAsHeader = true;
else {
    options.UseFirstRowAsHeader = false;
    options.DataSourceColumnTypeDetector = new MyColumnDetector();
}
options.SkipHiddenColumns = true;
rangeDS = dataRange.GetDataSource(options);
sheet.DataBindings.Error += DataBindings_Error;
vb
Dim options As New RangeDataSourceOptions()
Dim sheet As Worksheet = spreadsheetControl1.ActiveWorksheet
Dim dataRange As CellRange = sheet.Selection
If dataRange.Equals(sheet.Tables(0).Range) Then
    options.UseFirstRowAsHeader = True
Else
    options.UseFirstRowAsHeader = False
    options.DataSourceColumnTypeDetector = New MyColumnDetector()
End If
options.SkipHiddenColumns = True
rangeDS = dataRange.GetDataSource(options)
AddHandler sheet.DataBindings.Error, AddressOf DataBindings_Error

Inheritance

Object DataSourceOptionsBase RangeDataSourceOptions

See Also

RangeDataSourceOptions Members

Data Binding in WinForms Spreadsheet Control

DevExpress.Spreadsheet Namespace