Thursday, 12 September 2013

Difference between HSSFWorkbook and Workbook in apache POI

Difference between HSSFWorkbook and Workbook in apache POI

I was studying read/write of excel using apachePOI library, i found two
types of solution, i.e., one achieved using using HSSFWorkbook and other
one with Workbook. Now i have doubt why there is two solution to achieve
single functionality.
My Code:
FileInputStream fis=new
FileInputStream("D:\\Extras\\SeleniumPractice\\TestData.xlsx");
Workbook workbook=WorkbookFactory.create(fis);
Sheet sheet=workbook.getSheet("TestData");
When i searched:
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);
Thanks in advance.. :)
Thanks Mahesh

No comments:

Post a Comment