This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes HSSF and getNumericCellValue() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "HSSF and getNumericCellValue()" Watch "HSSF and getNumericCellValue()" New topic
Author

HSSF and getNumericCellValue()

Andrew Mcmurray
Ranch Hand

Joined: Sep 24, 2005
Posts: 188
Hi all,

I am using cell.getNumericCellValue() to get the value of a cell. I want have the value as a string so I toString the Double. The problem is the string then has the decimal and the E for values that are too big. Like 3.65871133792E13 where I want like 365871133792. Any thoughts?

Thanks,

AMD
Ajay Singh
Ranch Hand

Joined: Dec 13, 2006
Posts: 182
use NumberFormat to format it,

String text = new DecimalFormat("############").format(call.getNumericCallValue());
Andrew Mcmurray
Ranch Hand

Joined: Sep 24, 2005
Posts: 188
Thanks Ajay

It looks like I only needed on '#' on the Decimal format and it seemed to work.

AMD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HSSF and getNumericCellValue()
 
Similar Threads
Get the characters from String.
Passing a String by reference
replace value of string
String to int
How to read follwing String