struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gruner, Manfred" <Manfred.Gru...@gedas.de>
Subject RE: How to Generate .xls file from struts app.
Date Thu, 04 Apr 2002 10:49:49 GMT
Hi,
you don't have to generate csv-files take the html-Code itself,
and change the mime type to "application/vnd.ms-excel".
This should work too.
Manfred

> -----Original Message-----
> From: Jim Crossley [mailto:jcrossley@ifleet.com]
> Sent: Tuesday, April 02, 2002 4:34 PM
> To: Struts Users Mailing List
> Subject: Re: How to Generate .xls file from struts app.
> 
> 
> "gvn" <gvannuffelen@cora.be> writes:
> >
> > I would like to generate a .xls (excel) file data from a result set.
> > =20
> > What I have to do ?=20
> 
> One simple approach is to generate a CSV (Comma-Separated-Values) file
> instead, and then set the response's content type to
> "application/vnd.ms-excel".  That way, you exploit the fact that Excel
> transparently handles CSV files and rely on the browser to invoke
> Excel. 
> 
> Your action amounts to something not quite as trivial as this:
> 
>   PrintWriter out = response.getWriter();
>   while (youHaveRows)
>     while (youHaveColumns)
>       out.print(yourCell+",");
>   out.close();
>   response.setContentType("application/vnd.ms-excel");
> 
> -- 
> Jim Crossley
> http://www.lads.com/~jim
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:struts-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message