Solved

Data not getting properly displayed in the Excel file

Posted on 2006-06-16
9
234 Views
Last Modified: 2010-03-31
I have  a java program which  takes  Arraylist of objects and converts it into a Excel file. But when one of the values in the arraylist is "0736", the excel file displays as 736. But my business analyst is syaing it should display as 0736 to satisfy the requirements.

Thanks
Hari
0
Comment
Question by:SubhaBabu
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Why not enter it as a string?
0
 
LVL 2

Author Comment

by:SubhaBabu
Comment Utility
It is already a string.

Thanks
Subha
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 32 total points
Comment Utility
If it's taken away the zero it must *think* it's a number. Why would it otherwise?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 31 total points
Comment Utility
check if you can specify the cell property as text while converting to excel
0
 
LVL 5

Assisted Solution

by:tbboyett
tbboyett earned 31 total points
Comment Utility
What are you using to export the data as an excel file?  Are you using jExcel, exporting as a csv file, or something else?

If you are using jExcel you could look at the API at:

TEXT - Static variable in class jxl.write.NumberFormats
Forces numbers to be interpreted as text

You can download it here http://www.andykhan.com/jexcelapi/download.html
0
 
LVL 5

Expert Comment

by:tbboyett
Comment Utility
By the way, the problem is most likely because the default CellFormat is of type "General" and needs to be set to "Text" as ksivananth and CEHJ mentioned
0
 
LVL 92

Assisted Solution

by:objects
objects earned 31 total points
Comment Utility
try adding ' to front of string. eg. '0736
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now