ExcelSourceOptions Class

Contains options used to extract data from the Microsoft Excel workbook.

Namespace: DevExpress.DataAccess.Excel

Assembly: DevExpress.DataAccess.v19.2.dll

Declaration

public sealed class ExcelSourceOptions :
    ExcelSourceOptionsBase
Public NotInheritable Class ExcelSourceOptions
    Inherits ExcelSourceOptionsBase

Remarks

The ExcelDataSource class exposes the ExcelDataSource.SourceOptions property that accepts the ExcelSourceOptionsBase descendants (for instance, the ExcelSourceOptions objects). The ExcelSourceOptions class contains different options used to import data from the Microsoft Excel workbook.

The ExcelSourceOptions.ImportSettings property exposed by the ExcelSourceOptions class allows you to specify the approach used to import data from a workbook. For instance, you can select all data from the specified worksheet or specify the required cell range. To import data from the workbook, create the required ExcelSettingsBase object descendant and specify its settings.

The ExcelSourceOptions class also exposes the ExcelSourceOptions.Password property allowing you to specify the password used to access the protected workbook.

The following properties affect different options related to data extracting.

Examples

This example shows how to create an ExcelDataSource and select the specific cell range from the SalesPerson worksheet.

ExcelDataSource excelDataSource = new ExcelDataSource();
excelDataSource.Name = "Excel Data Source";
excelDataSource.FileName = HostingEnvironment.MapPath(@"~/App_Data/ExcelDataSource.xlsx");
ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("SalesPerson", "A1:L2000");
excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
excelDataSource.Fill();

Inheritance

See Also