Example #1
0
        public static List <string> GetSheetnames(string filePath, out string message)
        {
            message = "success";
            List <string> listSheetname = new List <string>();

            if (!IsExcelFile(filePath))
            {
                return(new List <string>());
            }
            if (ExcelUtils.getExcelExtesion(ExcelUtils.ExceType.Excel2003) == Path.GetExtension(filePath))
            {
                listSheetname = GetXlsSheetnames(filePath, out message);
            }
            else if (ExcelUtils.getExcelExtesion(ExcelUtils.ExceType.Excel2007) == Path.GetExtension(filePath))
            {
                listSheetname = GetXlsxSheetnames(filePath, out message);
            }
            return(listSheetname);
        }
Example #2
0
        public static bool IsExcelFile(string filePath)
        {
            string fileExtension = System.IO.Path.GetExtension(filePath);

            if (ExcelUtils.getExcelExtesion(ExcelUtils.ExceType.Excel2003) == fileExtension || ExcelUtils.getExcelExtesion(ExcelUtils.ExceType.Excel2007) == fileExtension)
            {
                return(true);
            }
            return(false);
        }