Have you looked at the org.apache.poi.ss.usermodel.DataFormatter class or the org.apache.poi.hssf.usermodel.HSSFDataFormatter class? More specifically, look at the formatCellValue() method - it takes a reference to the cell and returns a formatted String value that resembles the contents of that cell as they would be seen through the Excel application.
Yours Mark B PS If you are working with only the binary BIFF8 (.xls) files then you can use the HSSFDataFormatter class. If you are working with the OpenXML based file format (.xlsx) OR if you want to future proof your code so that it could be used to process either type of file, then use the Data Formatter class. Sistla Bhanu Prakash wrote: > > Currently i am using POI API to read the cell values, i have some issue > with the API, can any one help me in resolving issue. Here is the problem > > 1) Currently i have a Column Header with Postal Code/Zip Code > 2) Having cell value as "01234" when I read the data i get the value as > 1234, has any one face this type of problem and what is the work around > > Here is the code > > case HSSFCell.CELL_TYPE_NUMERIC: > value = > String.valueOf(cell.getNumericCellValue()).trim(); > > Thanks > Bhanu S > > -- View this message in context: http://www.nabble.com/Getting-wrong-cell-value-if-starts-with-01234-tp25934933p25935690.html Sent from the POI - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
