File file=new File(fileName);
List<String> list = new ArrayList<String>();
//得到 workbook
Workbook book = Workbook.getWorkbook(file);
//工作表个数
int sheetCount = book.getNumberOfSheets();
for(int i = 0; i < sheetCount; i++){
这里获取每一个sheet的值
Sheet sheet = book.getSheet(i);
int rows = sheet.getRows();//查看sheet的行
int columns = sheet.getColumns();//查看sheet的列
for(int r = 0; r < rows; r ++){
String s = "";
for(int c = 0; c < columns; c++){
String temp = sheet.getCell(c, r).getContents();//将单元格的每行内容用¥隔开
s = s + (temp==null?" ":temp.trim()) + "¥";
}
if(s.endsWith("¥")){
s = s.substring(0, s.length()-1);
}
list.add(s);
}
}
return list;