• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data is not properly export in the csv file

 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

In the below given code i am properly fetching the data from database.The value i am fetching from database i am export the data in the csv file.
The System.out.println prints like
PER_NR LNAME
000329 Cory
0011333 Kline
For PER_NR column data when export in the csv file it removes the 00 value in the left side.But i should export the value like example. 000329
Please suggest how i display 000 value in the csv file.




Thanks and Regards,
Sumanta Panda
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For PER_NR column data when export in the csv file it removes the 00 value in the left side.

Which editor did you use ? Excel ?
Excel formats the value as a number. Check the content of the file using a text editor.
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Microsoft office excel 2003.

Please suggest how to fix this error.

Thanks,
Sumanta Panda
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not an error in your Java code, nor in your CSV file. It's stupid Excel that thinks "all digits! it must be a number! cool! let's take off the leading zeros!". You may be able to solve this by specifying that the column is Text, not General or Number, but it wouldn't surprise me if this wouldn't work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic