Is there an easy way? Yes and no.  I've been working with this for some time
with an intranet based reporting application using MS Internet Explorer.
Anyways, what you need to do is to set the content type to a format that is
associated with excel, for example:

res.setContentType("application/x-msexcel");

where res is your HttpServletResponse object.

Some of the problems that I've run into with IE include:

-when Excel is launched it will make another connection to the web server
and request the page again, except that it doesn't provide correct cookie
information and I'm unable to access my session. If you're not using
sessions this shouldn't bother you.

-sometimes it will launch Excel within the browser window, other times it
will bring up excel as a seperate application - I'm sure that this can be
configured somehow within IE or Windows but not sure how.

MS IE does not bring up a pop-up asking you what you want to do with the
file - Netscape does by default.

Lee.

> -----Original Message-----
> From: Schmidt, Allen J. [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, April 06, 1999 9:51 AM
> To:   [EMAIL PROTECTED]
> Subject:      Exporting generated to Excel
>
> Is there an easy way to generate a table of data with a servlet and then
> have a Windows file save dialog pop up and save the table to an Excel
> spreadsheet?
>
> Thanks
>
> Allen Schmidt
> Northern VA Community College
> [EMAIL PROTECTED]
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to