Back to Devexpress

ExcelDataSource.SourceOptions Property

corelibraries-devexpress-dot-dataaccess-dot-excel-dot-exceldatasource-d3902a10.md

latest6.1 KB
Original Source

ExcelDataSource.SourceOptions Property

Gets or sets options used to extract data from Microsoft Excel workbooks (XLS, XLSX or XLSM files) or CSV files.

Namespace : DevExpress.DataAccess.Excel

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[DefaultValue(null)]
[LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)]
public ExcelSourceOptionsBase SourceOptions { get; set; }
vb
<DefaultValue(Nothing)>
<LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)>
Public Property SourceOptions As ExcelSourceOptionsBase

Property Value

TypeDefaultDescription
ExcelSourceOptionsBasenull

A ExcelSourceOptionsBase descendant containing options used to extract data from Microsoft Excel workbooks (XLS, XLSX or XLSM files) or CSV files.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the SourceOptions 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.

data-access-library-create-data-sources-at-runtime/CS/ExcelDataSourceSnippets/Code.cs#L23

csharp
csvSourceOptions.DetectValueSeparator = true;
    excelDataSource.SourceOptions = csvSourceOptions;
}

winforms-grid-open-excel-files/CS/Form1.cs#L21

csharp
var worksheetSettings = new ExcelWorksheetSettings("Sheet1", "A1:B3");
source.SourceOptions = new ExcelSourceOptions(worksheetSettings);
source.Fill();

asp-net-mvc-grid-upload-excel-file-using-upload-control-and-display-data-in-grid/CS/T449148/Models/Model.cs#L34

csharp
excelSourceOptions.UseFirstRowAsHeader = true;
excelDataSource.SourceOptions = excelSourceOptions;

reporting-winforms-bind-to-csv-file/CS/BindingReportToCsvFile/Form1.cs#L31

csharp
};
excelDataSource.SourceOptions = csvSourceOptions;

winforms-dashboard-grid-hyperlink-column/CS/Dashboard_GridHyperlinkColumn/Form1.cs#L17

csharp
excelDataSource.FileName = @"..\..\Data\GDPByCountry.xlsx";
excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1"));
dashboard.DataSources.Add(excelDataSource);

data-access-library-create-data-sources-at-runtime/VB/ExcelDataSourceSnippets/Code.vb#L21

vb
csvSourceOptions.DetectValueSeparator = True
    excelDataSource.SourceOptions = csvSourceOptions
End Sub

winforms-grid-open-excel-files/VB/Form1.vb#L16

vb
Dim worksheetSettings = New ExcelWorksheetSettings("Sheet1", "A1:B3")
source.SourceOptions = New ExcelSourceOptions(worksheetSettings)
source.Fill()

asp-net-mvc-grid-upload-excel-file-using-upload-control-and-display-data-in-grid/VB/T449148_VB/Models/Model.vb#L19

vb
excelSourceOptions.UseFirstRowAsHeader = True
excelDataSource.SourceOptions = excelSourceOptions
excelDataSource.Fill()

reporting-winforms-bind-to-csv-file/VB/BindingReportToCsvFile/Form1.vb#L23

vb
Dim csvSourceOptions As CsvSourceOptions = New CsvSourceOptions With {.DetectEncoding = True, .DetectNewlineType = True, .DetectValueSeparator = True}
excelDataSource.SourceOptions = csvSourceOptions
' Define the data source schema.

reporting-winforms-bind-excel-runtime/VB/BindingReportToExcelWorkbook/Form1.vb#L31

vb
excelSourceOptions.SkipHiddenColumns = False
excelDataSource.SourceOptions = excelSourceOptions
' Create new fields and specify their settings.

See Also

ExcelDataSource Class

ExcelDataSource Members

DevExpress.DataAccess.Excel Namespace