Hi,

For numerical cells the code is like this:

HSSFWorkbook wb = ...;

 HSSFDataFormat dataformat = wb.createDataFormat();

 double value = cell.getNumericCellValue(); //get the cell value

 HSSFCellStyle style =  cell.getCellStyle();
 short idx = style.getDataFormat();
 //get format pattern for this cell 
 String format = dataformat.getFormat(idx); 
 
 //try to create java formatter. Warning: This MAY not work in all cases!
 NumberFormat fmt = new DecimalFormat(format);
 String  fmtvalue = fmt.format(value); //compare it with what you have in 
Excel. 

Regards, Yegor


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to