This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes saving report as an excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "saving report as an excel file" Watch "saving report as an excel file" New topic
Author

saving report as an excel file

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
I have a report, which I need to save as an excel file.

The data is in a bean.
I retrieve the data from the bean, store in an arraylist. set the arraylist as an attribute of request.

in the jsp, i retrieve the list from the request attribute, iterate and store the contents in a stringbuffer.

the string buffer is as follows:

<TR><TD align='center' bgcolor='#C0C0C0'>09-05</TD><TD align='center' bgcolor='#C0
C0C0'>036EL0509662B</TD><TD align='center' bgcolor='#C0C0C0'>036</TD><TD align='center' bgcolor='#C0C0C0'>03605626</TD><TD align='center' bgcolor='#C0C0C0'>11
/28/2006</TD><TD align='center' bgcolor='#C0C0C0'>BP</TD><TD align='center' bgcolor='#C0C0C0'>09/22/2006</TD><TD align='center' bgcolor='#C0C0C0'>MOUNTAIN STA
TES </TD> </TR>

The response type is :

<% response.setContentType("application/vnd.ms-excel"); %>

However, when I see the data in the excel file, 09-05 becomes 5-sep, 036 becomes 36 and 03605626 becomes 3605626.

What am i missing?


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

I don't think that you are missing anything. Excel is probably providing its own formatting of the data.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: saving report as an excel file
 
Similar Threads
Problem while uploading an image using UploadBean
Data Display problem in JSP.
Html to database
JSP Help Regarding the Radio Button
How to keep the selected value ?