-
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
-
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.
-
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
-
Replies: 8
Last Post: 11-18-2005, 07:44 AM
-
Replies: 6
Last Post: 05-05-2005, 05:33 AM
-
Replies: 5
Last Post: 07-09-2001, 09:16 AM
-
Replies: 14
Last Post: 02-14-2001, 04:37 PM
-
Replies: 1
Last Post: 03-22-2000, 09: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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks