cell.getValue returns inconsistent class type (Java)

When using cell.getValue on a number column, the Object type returned is not the always what you would expect. For a money column the return was usually Double, but would sometimes return an Integer. When the value was 0, the return type was sometimes returned as String.

Had to use a wrapper function:

public static final Double getDoubleValue ( Cell cell ) {

static final DecimalFormat df = new DecimalFormat();
...
switch ( cell.getValueType() ) {
case CellValueType.DOUBLE:
return (Double)cell.getValue();

case CellValueType.INT:
return ((Integer)cell.getValue()).doubleValue();

case CellValueType.STRING:
return df.parse((String)cell.getValue() ).doubleValue();

default:
throw new NumberFormatException( "" );
}
...

}

Hi,

In Aspose.Cells for Java ,we use Double/Integer Object to store number value. We can support Cell.getDoubleValue() to return a double value.

It seems there's something wrong with setting the cells' value that the return type is String and the value was 0.Could you show me how to set the cells' value.