File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP  data to CSV format conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP  data to CSV format conversion" Watch "JSP  data to CSV format conversion" New topic

JSP data to CSV format conversion

prasanna kumar

Joined: Jun 27, 2004
Posts: 12
Hello friends

I'm converting a report which is in jsp file to a Comma separated value format.
whats happenening is when the field is a String which has numeric values like "123456678979708" the csv format treats it as a number and the data is printed in the excel sheet in the scientific notation. like 1.2 E10. IS there anyway to specify it as a plain text so that the number prints as it is.
I tried several approaches
1) I tried inserting a space before the number in the jsp so that the excel will consider it as a plain string
2) I tried putting the data within quotes in the jsp --- did not work either
3) I tried putting a '/' character .. still did not work

Is there any work around for this??

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

You'll have to emit actual Excel format. I do not believe that there is anything you can do with a CSV file.

[Asking smart questions] [About Bear] [Books by Bear]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Or you have to use Excels Import menu, which let's you specify which columns are text and which are numbers.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

In Excel, don't you see the actual number if you make the column wider?
Don't get me started about those stupid light bulbs.
subject: JSP data to CSV format conversion
It's not a secret anymore!