Xls_Reader Class has lot of errors in 'getCellData' method | Selenium Forum
D
Debadatta Rath Posted on 09/08/2019

Hello Sir...I am using latest version of Apache POI dependency in my project for Module-24 with latest version of executable jars.

One of the observation is that Xls_Reader Class has lot of errors in 'getCellData' method, since few of the classes under '

import org.apache.poi.ss.usermodel.Cell' have deprecated.
Could you please provide the latest version of this class file to resolve this issue?


Code Sniped which seems to be depricated is provided in code snippet section
 
if(cell==null)
				return "";
			//System.out.println(cell.getCellType());
			if(cell.getCellType()==Cell.CELL_TYPE_STRING)
				return cell.getStringCellValue();
			else if(cell.getCellType()==Cell.CELL_TYPE_NUMERIC || cell.getCellType()==Cell.CELL_TYPE_FORMULA ){

				String cellText  = String.valueOf(cell.getNumericCellValue());
			  if (HSSFDateUtil.isCellDateFormatted(cell)) {
		           // format in form of M/D/YY
				  double d = cell.getNumericCellValue();

 


D
Debadatta Rath Replied on 10/08/2019

I debuged and found that getCellData method defined in Xls_Reader have 'String colName' defined as listed:

public String getCellData(String sheetName,String colName,int rowNum){

 

However 'DataUtil.java' class is using numeric value in this field, hence getting errors(snapshot is attached)

 

while(!xls.getCellData("Data",0,testStartRowNum).equals(testName))
{

testStartRowNum++;

}


A
Ashish Thakur Replied on 10/08/2019

Please use POI 3.6. This will resolve major issues.

getCellData function accepts Column Name and Column index both. The function is overloaded


D
Debadatta Rath Replied on 17/08/2019

This issue is resolved. Please close this issue. Thanks so much