You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jonathan Sansalone <jo...@hotmail.com> on 2012/06/20 20:58:54 UTC

How convert the value of scientific notation ?

Hello everybody!
I have a problem to obtain a numerical value of a cell. When the value is too large, it comes as scientific notation and if I convert to string it continues!
I tried:
1- double d = myRow.getCell(1).getNumericCellValue(); // The value d is 1.23E+14// Convert to String is the same thing
2- NumberFormat nf = NumberFormat.getInstance(); String s = nf.format(d); // the value is now "123.000.000.000.000" s = s.replace(".",""); // the value back to 1.23E+14
How do I do to get this value in scientific notation and get the real value?
Jonathan Sansalone P. Rolim

Programador Júnior - Java Standard Edition Programador Júnior - Java Enterprise Edition 
Sistemas de Informação - 2011
 		 	   		  

Re: How convert the value of scientific notation ?

Posted by Nick Burch <ni...@alfresco.com>.
On Wed, 20 Jun 2012, Jonathan Sansalone wrote:
> I have a problem to obtain a numerical value of a cell. When the value 
> is too large, it comes as scientific notation and if I convert to string 
> it continues!

As long as you have it as a double, how you print it out is entirely up to 
you. If the default Double.toString isn't to your liking, you can use a 
different formatter!

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: How convert the value of scientific notation ?

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
Well, you might take a look at the BigDecimal class (java.math.BigDecimal)
and it's toPlainString() method. Never tried it myself but it might work.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-convert-the-value-of-scientific-notation-tp5710265p5710272.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org