• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display exponents to a number in excel

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic