poi兼容excel2003和2007写法

            //创建excel文件薄对象

            Workbook workBook;

            

            fileInputStream = new FileInputStream(phonesUrl);

            

            try 

            {

                //读取exl 2007

                workBook = new XSSFWorkbook(fileInputStream);

            } 

            catch (Exception ex) 

            {

                //读取exl 2003

                fileInputStream.close();

                fileInputStream = new FileInputStream(phonesUrl);

                workBook = new HSSFWorkbook(fileInputStream);

            }

你可能感兴趣的:(excel2003)