Solved

Data not getting properly displayed in the Excel file

Posted on 2006-06-16
9
236 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 53
how do i compare an object based on two fields 6 54
hibernate example issues from command prompt 10 42
mysql jsp example issue 32 38
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

831 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