Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to display exponents to a number in excel

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I am writing some data into an excel file using Struts2. The policy number is of type String and when I download the csv file and open it in excel the policy number comes as exponent. It is a large number therefore excel displays it this way but is there any way in Java side to take care of such thing.

I want this 4.01021E+13 to be 40102100156108

Can I convert this String to show up as a number rather than exponent in Java.
Thanks.



 
Bartender
Posts: 9559
12
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you formatting the field as a String in your CSV (i.e. enclosing the value in double-quotes)?  
Comma-separated values
 
syed yousuf sadat
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In CSV, I am not doing anything. I just get the values through getters and write them in CSV. This field is of type String and it is almost 15 digit number.
 
syed yousuf sadat
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I added a single quote just before the getter and appending it to it. It displays the complete number but it also prints the quote which I don't want.

This is how it showed up: '0412365987456321
This is how I want it:        0412365987456321
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!