excel导入时,对两种版本格式的支持
InputStream fis = file.getInputStream(); Workbook wookbook = null; String filename = file.getOriginalFilename(); filename = filename.trim(); filename = filename.substring(0, filename.lastIndexOf(".")); String suffix=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));//后缀名 if(suffix.equals(".xls")){ wookbook = new HSSFWorkbook(fis); }else if(suffix.equals(".xlsx")){ wookbook = new XSSFWorkbook(fis); }else { throw new RuntimeException("不支持的格式:"+suffix); }