Workbook book = null;
try {
book = new XSSFWorkbook(excelFile);
} catch (Exception ex) {
book = new HSSFWorkbook(new FileInputStream(excelFile));
}
感謝:http://www.blogjava.net/spinage/archive/2011/03/16/346409.html