I wanted to get the value of a Numeric cell as a simple string.
Suppose there the type of cell is numeric with value 90%
.
Now I cannot use cell.ge
Try
cell.getRichStringCellValue ().getString();
Have a look at this example
Here is Doc
You can force the value to be returned as a String using the methods below
HSSFDataFormatter hdf = new HSSFDataFormatter();
System.out.println (hdf.formatCellValue(mycell));
will return "90%"
The API for this method is at http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/DataFormatter.html#formatCellValue%28org.apache.poi.ss.usermodel.Cell%29
This works directly even with an HSSFCell
it worked for me even when my Cell is an HSSFCell
i've also tried this cast - which works.
HSSFCell cell1 = (HSSFCell) row1.getCell(2);
HSSFDataFormatter hdf = new HSSFDataFormatter();
System.out.println ("formatted "+ hdf.formatCellValue(cell1));