Skip to main content
A newer version of this page is available. .

ExcelDataSource.FillAsync() Method

Populates the ExcelDataSource in an asynchronous manner.

Namespace: DevExpress.DataAccess.Excel

Assembly: DevExpress.DataAccess.v19.2.dll

Declaration

public Task FillAsync()

Returns

Type Description
Task

A task that populates the data source.

Remarks

Use this method to populate an Excel data source in an individual task asynchronously. Unlike the Fill() method call, FillAsync does not lock other actions performed concurrently. For instance, the user interface remains operational while the data source is populated.

Call the FillAsync method with the await operator.

Example

The code sample below creates an ExcelDataSource and populates it in an asynchronous manner.

using System.Threading;
using System.Threading.Tasks;
using System.IO;
using DevExpress.Utils;
using DevExpress.DataAccess.Excel;
// ...
// Create and configure an Excel data source.
ExcelDataSource excelDataSource = new ExcelDataSource();
excelDataSource.Name = "Excel Data Source";
excelDataSource.FileName = Path.Combine(Path.GetDirectoryName(typeof(ReportCreator).Assembly.Location), "Sales.xlsx");
ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("SalesPerson", "A1:L2000");
excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
// Populate the data source.
await excelDataSource.FillAsync();
report.DataSource = excelDataSource;
See Also