Hi all,
when I try to retrieve the values from some cells,
the returned format confuses me. Maybe you can help.
1. In Excel, I formatted all cells as Strings.
2. In the code it looks like this:
private String convertToString(HSSFCell cell) {
String ret = "";
if (cell != null)
{
int type = cell.getCellType();
switch (type)
{
case HSSFCell.CELL_TYPE_BLANK:
case HSSFCell.CELL_TYPE_BOOLEAN:
case HSSFCell.CELL_TYPE_ERROR:
case HSSFCell.CELL_TYPE_FORMULA:
break;
case HSSFCell.CELL_TYPE_NUMERIC:
ret = Double.toString(cell.getNumericCellValue());
System.out.println("number: " + ret);
break;
case HSSFCell.CELL_TYPE_STRING:
ret = cell.getStringCellValue();
System.out.println("String: " + ret);
break;
}
}
return ret;
}
3. With Strings, erverything is ok. Values consisting of numbers
appear as numbers (although I had formatted them as Strings in Excel).
4.Furthermore, A number like 736132469 is displayed as 7.36132469E8
Any suggestions?
Thank you very much.
Regards, Digo
---------------------------------------------------------------------
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/