jsp:converting table to excel

M

mulderbaba

Hi all,
I am outputting a table from a jsp to excel by
response.setContentType("application/vnd.ms-excel");
everythin' is ok with this. I have string fields contains strings like
'930000000000' but excel accepts them as numbers and displays like
9,3E+11.
I just wanna see 930000000000 and treat them as text. (if i put '
before the 930000000000 then the cells got texted but i see the ' also
in every cell.)
How can i tell the excel not to do this? should i use CSV format?

Thx.
mulderBaba
 
J

JScoobyCed

Hi all,
I am outputting a table from a jsp to excel by
response.setContentType("application/vnd.ms-excel");
everythin' is ok with this. I have string fields contains strings like
'930000000000' but excel accepts them as numbers and displays like
9,3E+11.
I just wanna see 930000000000 and treat them as text. (if i put '
before the 930000000000 then the cells got texted but i see the ' also
in every cell.)
How can i tell the excel not to do this? should i use CSV format?

This is not a Java problem. You just need to use the format of the cell you
want to display. Something like Edit/Format/ and select String in Excel.
Then look how Excel has changed the data in the file and do the same through
your JSP. Consult an Excel oriented newsgroup for more detailed.

JScoobyCed
-------------
 
M

mulderbaba

This is not a Java problem. You just need to use the format of the cell you
want to display. Something like Edit/Format/ and select String in Excel.
Then look how Excel has changed the data in the file and do the same through
your JSP. Consult an Excel oriented newsgroup for more detailed.

I think it's a java problem. Because before outputting a table you
cannot set the format of the cell. I sure can set the format from
excel as you mentioned. but the change on the cell cannot be
perceived. There is no usage of special character by excel. I should
give a shot to consulting to an Excel oriented newsgroup. Thank you.
 
M

Michael Scovetta

Excel uses CSS extensively, but it's a Microsoft-specific CSS. I've
been looking for specs to it, but to no avail. The best bet is to just
write your output as an HTML table, then change it in Excel and save
it as a web page. You'll get a whole bunch of garbage, but you should
be able to see what makes the cells have a particular attribute, and
then do that from JSP. There are a number of packages out there that
will help you write native Excel, including Jakara's POI:
http://jakarta.apache.org/poi/index.html

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top