• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Data not getting properly displayed in the Excel file

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
SubhaBabu
Asked:
SubhaBabu
4 Solutions
 
CEHJCommented:
Why not enter it as a string?
0
 
SubhaBabuAuthor Commented:
It is already a string.

Thanks
Subha
0
 
CEHJCommented:
If it's taken away the zero it must *think* it's a number. Why would it otherwise?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ksivananthCommented:
check if you can specify the cell property as text while converting to excel
0
 
tbboyettCommented:
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
 
tbboyettCommented:
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
 
objectsCommented:
try adding ' to front of string. eg. '0736
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now