Formatting CSV Files using java??


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Formatting CSV Files using java??

  1. #1
    Join Date
    Apr 2005
    Posts
    15

    Formatting CSV Files using java??

    Hi,

    Through my application i am generating csv files which are my reports.
    In that report some data like amount ,a number..etc are there.

    When the report gets generated & i open this CSV file in excel , i am not getting the exact data i wrote to the file , that is :

    If there are any preceding ZEROES in the number they gets truncated (for e.g 050123 tehn only 50123 is wrote) OR in the case of AMOUNT if the amount is of the form 1200.00 then only 1200 is written, I mean this the problem i am facing with the leading & trailing zeroes in the figures if i m not mistaken??

    So is there any way to format this report AFTER GETTING GENERATED using java??

    Thanks,
    Jignesh

  2. #2
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    for leading zeroes you should consider to export them with quotation marks, so they are interpreted as strings., eg "050123".
    while importing to excel, you have lots of options on how rows should be interpreted. if you select the right format in excel import, the 1200.00 should be shown with two decimal numbers after the point. you also can declare in excel import the fields having leading zeroes to be interpreted as strings, otherwise excel will truncate any leading zeroes. particaullarly this is an excel problem. any application using your csv can have it's own representation and interpretation on how and what to do with the data.

  3. #3
    Join Date
    Apr 2005
    Posts
    15
    Hi,

    Thanks for the reply.
    All my values which i am fetching from the database are Strings only.I tried while writing my values to the file beginning & ending with double quotes (that is like this "050123".) but the values being written to the file are shown with double quotes displaying that is it is shown in the file in the format "050123" but i want to make it display 050123 .And what about amount with decimal places ending with ZEROES .How can i write that to my file in the same format i am fetching from the database??

    Thanks,
    Jignesh

Similar Threads

  1. Header Files compared to Java
    By ZeroFear in forum C++
    Replies: 8
    Last Post: 11-18-2005, 08:44 AM
  2. Replies: 6
    Last Post: 05-05-2005, 06:33 AM
  3. XML, Java and not using files
    By chris in forum XML
    Replies: 5
    Last Post: 07-09-2001, 10:16 AM
  4. Future of Java....
    By JW in forum Careers
    Replies: 14
    Last Post: 02-14-2001, 05:37 PM
  5. Replies: 1
    Last Post: 03-22-2000, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center