open an excel file outside IE

Discussions

Web tier: servlets, JSP, Web frameworks: open an excel file outside IE

  1. open an excel file outside IE (3 messages)

    Hi,

    I'm using POI to write in an excel file.But I cannot open the excel file outside the IE.

    How can I solve the problem?

    Thanks a lot.

                                          
    bao-intoo

    Threaded Messages (3)

  2. open an excel file outside IE[ Go to top ]

    Make sure that whatever servlet or JSP you are using to serve up the Excel file sets the content type (MIME type) to "application/vnd.ms-excel".
  3. open an excel file outside IE[ Go to top ]

    After you create the file using POI,stream this to the response, and set the following:
      response.setContentType("application/excel")
      response.setHeader("Content-disposition","attachment; filename=file.xls");

    You can give some file name in the Content-disposition header.

    This will make the browser to prompt, whether to open or save the file.
  4. open an excel file outside IE[ Go to top ]

    Pls try adding the following lines to your web.xml file

    <mime-mapping>
      <extension>xls</extension>
      <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>