poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marek Wozny" <marek.wo...@bq-projects.de>
Subject AW: HSSF Failure in IE
Date Thu, 15 Dec 2005 11:06:27 GMT
hi, maybe this code solves your problem. In my application this source works fine with IE 6.

FileOutputStream fileOut = new FileOutputStream(binaryPath+filename);
wbBid.write(fileOut);
fileOut.close();
		
//--- File erstellen
File fileBid = new File(binaryPath+filename);
		
//--- Header setzen um Download-Popup zu bekommen
response.addHeader("Content-Disposition","attachment;filename="+fileBid.getName());
response.addHeader("Content-Transfer-Encoding", "binary");
response.setContentType(application.getMimeType(fileBid.getName()));
response.setContentLength((int) fileBid.length());		
response.setHeader("Pragma", "no-cache");
		
InputStream in = new FileInputStream(fileBid);
ServletOutputStream outs = response.getOutputStream();
		
//--- Buffer löschen vorm schreiben !WICHTIG!
out.clearBuffer();

int bit = 256;
int i = 0;
try 
{
	while ((bit) >= 0) 
	{
		bit = in.read();
		outs.write(bit);
	}
}
catch (IOException ioe) { ioe.printStackTrace(System.out); }
       
//Streams freigeben und schließen
outs.flush();
outs.close();
in.close();


-----Ursprüngliche Nachricht-----
Von: Iain.Shepherd@barclayscapital.com [mailto:Iain.Shepherd@barclayscapital.com] 
Gesendet: Donnerstag, 15. Dezember 2005 10:33
An: poi-user@jakarta.apache.org
Betreff: RE: HSSF Failure in IE

> This one sends back a 'redirect' to the browser, telling it to fetch 
> outputxls.xls or even 
> outputxls.xls?filename=myworksheet&extension=.xls as the final result.

An alternative I've used is to fetch a filename like:
> output.xls.jsp?parameters....

According to some MS Knowledge Base article I can't remember, even a URL like this will trick
IE into treating it as a XLS.

Iain


-----Original Message-----
From: Christian Gosch [mailto:c.gosch@inovex.de]
Sent: 15 December 2005 08:35
To: POI Users List
Subject: Re: HSSF Failure in IE


There may be another issue, too, although I am curious about what
happens when using "Content-Disposition" in correct capitalization.

IE uses different information sources to determine whats coming over the
net, as I said before. I forgot to mention the "extension of the URL".
Its a bit funny, but it _may_ help to append ".xls" to the request which
finally gets the data.

For example: We have a JSP displaying a link to a struts action which
does some preprocessing and forwards "externally" ("redirect='true'" in
struts-config.xml) to a servlet effectively producing the result. The
link on the page is something like preparexls.do which calls something
like PrepareXlsAction. This one sends back a 'redirect' to the browser,
telling it to fetch outputxls.xls or even
outputxls.xls?filename=myworksheet&extension=.xls
as the final result.

If everything else fails, you may check that out additionally.

Regards,
Christian


On Wednesday, December 14, 2005 10:44 AM [GMT+1=CET],
Nick Burch <nick@torchbox.com> wrote:

> On Tue, 13 Dec 2005, Dick Hildreth wrote:
>> content-disposition: attachment; filename=actionitems.xls
>
>> Content-disposition: attachment; filename=actionitems.xls
>
> The header is called "Content-Disposition", isn't it? (Note the 
> capitalisation - that's the form that RFC2183 has it in anyway)
>
> Perhaps IE is being funny about the case?
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Gruesse,
-- 
Dipl.-Inform. Christian Gosch
Systems Development
inovex GmbH
Karlsruher Strasse 71
D-75179 Pforzheim
Tel.: +49 (0)72 31 - 31 91 - 85
Fax: +49 (0)72 31 - 31 91 - 91
mailto:c.gosch@inovex.de
http://www.inovex.de


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/



------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.

------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/




---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message