티스토리 뷰
using(OpenFileDialog ofd = new OpenFileDialog() { Filter="Excel WorkBook|*.xlsx",ValidateNames = true })
{
if (ofd.ShowDialog() == DialogResult.OK)
{
FileStream fs = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
if(Path.GetExtension(ofd.FileName).ToUpper() == ".XLS")
{
reader = ExcelReaderFactory.CreateBinaryReader(fs);
}
else if(Path.GetExtension(ofd.FileName).ToUpper() == ".XLSX")
{
reader = ExcelReaderFactory.CreateOpenXmlReader(fs);
}
else
{
}
result = reader.AsDataSet(new ExcelDataSetConfiguration() // IsFirstRowColumnNames
{
ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
{
UseHeaderRow = true
}
});
comboBox1.Items.Clear();
foreach(DataTable dt in result.Tables)
{
comboBox1.Items.Add(dt.TableName);
reader.Close();
}
ExcelDataReader 를 이용하여 파일 읽을 때 기존에 있는 자료들로는
reader.IsFirstRowColumnNames = true;
를 체크하게 되어있는데 현재 최신으로 업데이트 되어있는 API에는
해당 IsFirstRowColumnNames 메서드가 AsDataSet 메서드에 포함되었습니다.
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 리버풀
- 송절동
- 살라
- 정보처리기사 실기 후기
- LG가전
- 19-20 리버풀 유니폼
- 챔피언스리그 우승은 과연?
- 해오름식당
- 동궁원
- 큐넷
- 교촌마을
- 우정여행
- 신혼가전
- 경주여행
- 기사 실기
- 강남 뉴발란스
- 리버풀 공식 스토어
- 키덜트뮤지엄
- 유니폼 직구
- 알렉산더 아놀드
- 첨성대
- LG오브제
- 리버풀 유니폼
- 남자여행
- 봉명동
- 송절동맛집
- 아놀드
- 대릉원
- 리버풀 홈 유니폼 후기
- 유니폼 착샷
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
글 보관함