ResultDate resultDate=null; InputStream input; try { input = new FileInputStream(file); //获取workbook对象 Workbook wb = Workbook.getWorkbook(input); //获取excel第一页 sheet = wb.getSheet(0); //获取sheet表中的总列数 //int rsClomns = sheet.getColumns(); //参数1是列,参数2是行 String memberSex=sheet.getCell(1, i).getContents(); resultDate=importFileService.importMemberInfo(sheet); } catch (Exception e) { resultDate = new ResultDate("导入会员相关数据失败,请检查数据是否符合要求",""); logger.error("导入失败 "+this.getClass().getName()+":"+e.getMessage()); e.printStackTrace(); } finally{ if(wb!=null){ wb.close(); } if(input!=null){ try { input.close(); } catch (IOException e) { logger.error("流关闭失败", e); } } }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/225917.html原文链接:https://javaforall.net
