nagireddy
nagireddy

Reputation: 491

convert excel cell text into number poi

HAI

i want ot convert a cell text value into a number in Excel using POI API.

cell text value like '2,345' to conver as a number.

How can i do that.

if any has face this problem,please let me know...

Upvotes: 2

Views: 11185

Answers (1)

True Soft
True Soft

Reputation: 8786

In case you have the value stored as a String, use:

String valueAsString = "2345";
cell.setCellValue(new BigDecimal(valueAsString).doubleValue());

If your value is a number, pass it to the method directly:

cell.setCellValue(2345);

Upvotes: 7

Related Questions