Hi Chris,

thanks a lot!

I updated to :

 res.setHeader("Cache-Control", "private");
 res.setHeader("Cache-Control", "private, must-revalidate");
 res.setHeader("Pragma","private");
 res.setContentType("application/vnd.ms-excel");
  res.setHeader("Content-Disposition", "inline");
  res.setContentLength(fileData.length);
  res.setHeader("Content-Transfer-Encoding", "binary");


IE 9 works, but IE8 still did not open the file :(

Do you know how to fix the problem for IE8.

Emi




On 09/26/2011 01:40 PM, Chris Pratt wrote:
Try removing the filename from the Content-Disposition header. "inline"
doesn't support this attribute and maybe IE is assuming you mean
"external" because it's there.
   (*Chris*)

On Mon, Sep 26, 2011 at 10:30 AM, Emi Lu <em...@encs.concordia.ca
<mailto:em...@encs.concordia.ca>> wrote:

    Hello ,

    I know its not really struts question. But maybe someone knows the
    answer.

    IE cannot open an excel file directly (IE8,9)

      res.reset();
      res.setHeader("Cache-Control", "private, must-revalidate");
      res.setHeader("Pragma","__private");
      res.setContentType("__application/vnd.ms-excel");
      res.setHeader("Content-__Disposition", "inline;filename=\""+
    "fn.xls" + "\";");
      res.setContentLength(fileData.__length);
      res.setHeader("Content-__Transfer-Encoding", "binary");

    If I save as a file, open it, excel shows:

    "Office File Validation detected a problem while trying to open this
    file. Opening it may be dangerous"

    Then I have to click "open" to open it.

    Does someone know how to open excel file directly but not have to
    save as under IE please?

    thanks a lot!
    Emi

    ------------------------------__------------------------------__---------
    To unsubscribe, e-mail: user-unsubscribe@struts.__apache.org
    <mailto:user-unsubscr...@struts.apache.org>
    For additional commands, e-mail: user-h...@struts.apache.org
    <mailto:user-h...@struts.apache.org>




--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
em...@encs.concordia.ca        +1 514 848-2424 x5884

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to