input = new FileInputStream(fileName);blog
Workbook wb = (Workbook) (isExcel2003 ? new HSSFWorkbook(input) : new XSSFWorkbook(fileName));input
上面的這個寫法input不能close以及刪除file
下面這種寫法便可
HSSFWorkbook wb2003 = null;
XSSFWorkbook wb2007 = null;
if(isExcel2003){
wb2003 = new HSSFWorkbook(input);
}else{
wb2007 = new XSSFWorkbook(input);
}
im
這是NPOI的一個死坑!!!img