반응형
로컬에 있는 파일경로 읽어오기
링크 : OpenFileDialog
private string ShowFileOpenDialog()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "엑셀파일 선택";
ofd.FileName = "";
ofd.Filter = "엑셀 파일 (*.xlsx, *.xls, *.xltx, *.xlt) | *.xlsx; *.xls; *.xltx; *.xlt;";
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
return ofd.FileName;
else if (dr == DialogResult.Cancel)
return "";
return "";
}
1. Title : 파일선택창 타이틀
2. Filter : 엑셀 파일 (*.xlsx, *.xls, *.xltx, *.xlt) | *.xlsx; *.xls; *.xltx; *.xlt;
- 화면에 나오는 부분 : 엑셀 파일 (*.xlsx, *.xls, *.xltx, *.xlt)
- 필터할 확장자 : *.xlsx; *.xls; *.xltx; *.xlt;
반응형
'백엔드 > C#' 카테고리의 다른 글
자주 쓰는 단축키 (0) | 2018.06.04 |
---|---|
엑셀파일 읽기 (0) | 2018.05.13 |
DataTable을 DataGridView에 DataBinding (0) | 2018.05.11 |
Form을 하나만 열고 싶을 때 (0) | 2018.05.11 |
Mdi Form / Mdi Child Form (0) | 2018.05.10 |
댓글