From: Avik Sengupta Date: Wed, 12 Jun 2002 17:43:17 +0000 (+0000) Subject: some more details on the faq X-Git-Tag: REL_1_10~316 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8b2a0506e533c1d4f98af6ea79911eded6328d1d;p=poi.git some more details on the faq git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352690 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/xdocs/faq.xml b/src/documentation/xdocs/faq.xml index 8fe16cd55b..5852a85086 100644 --- a/src/documentation/xdocs/faq.xml +++ b/src/documentation/xdocs/faq.xml @@ -114,15 +114,38 @@ public static boolean isCellDateFormatted(HSSFCell cell) {

- Dont depend on IE to show you an attachment properly if you stream it via a - servlet. Every minor version of IE has different bugs. + The problem usually manifests itself as the junk characters being shown on + screen. The problem persists even though you have set the correct mime type.

- To guarantee it to work, instead of doing a server-side redirect - (requestdispather), try doing a client side redirect to your xls file. Thats - guaranteed to work ... (also keep in mind that *sometimes* IE makes TWO - requests for a document that is opened by an external handler .. so if your xls - production is heavy, you might have a problem.) + The short answer is, dont depend on IE to display a binary file type you an attachment properly if you stream it via a + servlet. Every minor version of IE has different bugs on this issue. +

+

+ The problem in most versions of IE is that it does not use the mime type on + the HTTP response to determine the file type; rather it uses the file extension + on the request. Thus you might want to add a .xls to your request + string. For example http://yourserver.com/myServelet.xls?param1=xx. Sometimes + a request like http://yourserver.com/myServelet?param1=xx&dummy=file.xls is also + known to work. +

+

+ To guarantee opening the file properly in Excel from IE, write out your file to a + temporary file under your web root from your servelet. Then send an http response + to the browser to do a client side redirection to your temp file. (If you do a + server side redirect using RequestDispatcher, you will have to add .xls to the + request as mentioned above.) +

+

+ Note also that sometimes when you request a document that is opened with an + external handler, IE sometimes makes two requests to the webserver. So if your + generating process is heavy, it makes sense to write out to a temporary file, so that multiple + requests happen for a static file. +

+

+ None of this is particular to Excel. The same problem arises when you try to + generate any binary file dynamically to an IE client. For example, if you generate + pdf files using FOP, you will come across many of the same issues.