Solved

Data not getting properly displayed in the Excel file

Posted on 2006-06-16
9
235 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
ID: 16923322
Why not enter it as a string?
0
 
LVL 2

Author Comment

by:SubhaBabu
ID: 16923407
It is already a string.

Thanks
Subha
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 32 total points
ID: 16923424
If it's taken away the zero it must *think* it's a number. Why would it otherwise?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 31 total points
ID: 16923616
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
ID: 16923863
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
ID: 16923877
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
ID: 16924166
try adding ' to front of string. eg. '0736
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JAVA part two 5 57
java.io.BufferedReader   readLine()  //returns the entire file ? 4 60
split string containing \r\n in Java 46 38
expectj telnet failing 5 26
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

920 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

16 Experts available now in Live!

Get 1:1 Help Now