officefileapi-devexpress-dot-spreadsheet-dot-rangedatasourceoptions.md
Specifies whether to use the text contained in the first row cells of the data source range as column headers.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
public bool UseFirstRowAsHeader { get; set; }
Public Property UseFirstRowAsHeader As Boolean
| Type | Description |
|---|---|
| Boolean |
true , to retrieve the column names from the corresponding cells of the first row; otherwise, false.
|
If any of the cells within the first row is empty, the header for the corresponding column is Column X , where X is the ordinal number of the column with empty header. If the first row contains duplicate names, an ArgumentException in thrown.
Instead of using headers to specify column names, you can implement a custom class which provides column names. Assign an instance of this class to the RangeDataSourceOptions.DataSourceColumnTypeDetector property when creating a data source.
The following code snippets (auto-collected from DevExpress Examples) contain references to the UseFirstRowAsHeader property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-spreadsheet-use-cell-range-as-data-source/CS/RangeDataSource/Form1.cs#L32
if (dataRange.Equals(sheet.Tables[0].Range))
options.UseFirstRowAsHeader = true;
else {
RangeDataSourceOptions options = new RangeDataSourceOptions();
options.UseFirstRowAsHeader = true;
options.CellValueConverter = new MyPictureProvider(wb.Worksheets[0]);
winforms-spreadsheet-use-cell-range-as-data-source/VB/RangeDataSource/Form1.vb#L36
If dataRange.Equals(sheet.Tables(0).Range) Then
options.UseFirstRowAsHeader = True
Else
Dim options As RangeDataSourceOptions = New RangeDataSourceOptions()
options.UseFirstRowAsHeader = True
options.CellValueConverter = New MyPictureProvider(wb.Worksheets(0))
See Also