IWorkbook wk = null; if (filePath.ToLower() == ".xls") { wk = new HSSFWorkbook(fs); } else { wk = new XSSFWorkbook(fs); } ps:对象HSSFWorkbook支持excel2003 对象HSSFWorkbook支持excel2007