예제 #1
0
        private void LoadFileIntoDataTable()
        {
            if (File.Exists(_FileName))
            {
                string fileType = _FileName.Substring(_FileName.LastIndexOf(".") + 1);
                switch (fileType.ToLower())
                {
                case "csv":
                    string csvText = Utilities.readFile(_FileName);
                    _UploadedSheetTable = CsvParser.Parse(csvText);
                    break;

                case "xls":
                case "xlsx":
                case "xlsm":
                    _UploadedSheetTable = ExcelParser.Parse(_FileName);
                    break;

                case "pdf":
                    _UploadedSheetTable = PDFParser.Parse(_FileName);
                    break;

                default:
                    break;
                }
            }
            if (_UploadedSheetTable == null)
            {
                throw new Exception("There was an issue converting the file to a data table.");
            }
        }