我正在使用apachePOI库研究excel的读/写,我找到了两种类型的解决方案,即一种使用HSSFWorkbook实现,另一种使用Workbook实现.现在我怀疑为什么有两种解决方案来实现单一功能.
我的代码:
FileInputStream fis=new FileInputStream("D:\\Extras\\SeleniumPractice\\TestData.xlsx");
Workbook workbook=WorkbookFactory.create(fis);
Sheet sheet=workbook.getSheet("TestData");
Run Code Online (Sandbox Code Playgroud)
当我搜索:
FileInputStream file = new FileInputStream(new File("C:\\test.xls"));
//Get the workbook instance for XLS file
HSSFWorkbook workbook = new HSSFWorkbook(file);
//Get first sheet from the workbook
HSSFSheet sheet = workbook.getSheetAt(0);
Run Code Online (Sandbox Code Playgroud)
提前致谢.. :)
谢谢Mahesh
apache-poi ×1