Have a look at this class - org.apache.poi.ss.usermodel.DataFormatter - more
specifically at the public java.lang.String formatCellValue(Cell cell)
method which, and I quote;

"Returns the formatted value of a cell as a String regardless of the cell
type. If the Excel format pattern cannot be parsed then the cell value will
be formatted using a default format.

When passed a null or blank cell, this method will return an empty String
(""). Formulas in formula type cells will not be evaluated."


That could well do what you require.

Yours

Mark B

PS there is also a subclass of this called HSSFDataFormatter.


Sooraj wrote:
> 
> Hi,
> 
> The cell in my excel sheet has value "2:02" displayed in it and its format
> is custom(h:mm). 
> On reading this cell using POI , the cell type is Numeric and the
> cell.getNumericCellValue() returns 1.86777 (a numeric representaion of 31
> Dec 1989). 
> Is there anyway to get the value "2:02" ? or is there anyway to get the
> display string of the cell , irrespective of the cell format?
> 
> Thanks,
> Sooraj
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-read-the-the-display-string-of-a-cell%2C-irrespective-of-its-format%2C-using-POI-tp25783924p25789390.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to