DevExpress&UI
[DevExoress] Excel Binding for GridControl
Code GGOON
2020. 8. 27. 12:49
반응형
Devexpress에서 엑셀파일의 데이터를 그리드콘트롤러에 "가져오기"를 구현하기 위한 Sample Code
using DevExpress.DataAccess.Excel;
//. . .
DevExpress.DataAccess.Excel.ExcelDataSource myExcelSource = new DevExpress.DataAccess.Excel.ExcelDataSource();
myExcelSource.FileName = @"d:\Work\Excel DataSources\Book1.xlsx";
ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("SalesPerson", "A1:L13");
myExcelSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
//or
myExcelSource.SourceOptions = new CsvSourceOptions() { CellRange = "A1:L100" };
myExcelSource.SourceOptions.SkipEmptyRows = false;
myExcelSource.SourceOptions.UseFirstRowAsHeader = true;
myExcelSource.Fill();
gridControl1.DataSource = myExcelSource;
반응형