修复使用设计上的缺陷
This commit is contained in:
parent
74aa9781e1
commit
923aae75c5
@ -235,9 +235,9 @@ public class ExcelKit {
|
||||
List<Map> maps = readExcel(sheet, fields, lastRowNum);
|
||||
|
||||
//move head
|
||||
if (lastRowNum < 0 && maps.size() > 0) {
|
||||
/*if (lastRowNum < 0 && maps.size() > 0) {
|
||||
maps.remove(0);
|
||||
}
|
||||
}*/
|
||||
data.put(sheet.getSheetName(), maps);
|
||||
}
|
||||
return data;
|
||||
@ -358,13 +358,27 @@ public class ExcelKit {
|
||||
|
||||
private static Workbook getWorkbook(File file) throws IOException {
|
||||
Workbook wk;
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
try {
|
||||
wk = new HSSFWorkbook(new FileInputStream(file));//if excel version 2007+ will throws OfficeXmlFileException
|
||||
wk = new HSSFWorkbook(fis);//if excel version 2007+ will throws OfficeXmlFileException
|
||||
} catch (OfficeXmlFileException e) {
|
||||
wk = new XSSFWorkbook(new FileInputStream(file));
|
||||
wk = new XSSFWorkbook(fis);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return wk;
|
||||
}
|
||||
|
||||
//dev
|
||||
public void setWorkbook(File file) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user