excel文件生成后,路径指向它,放到要打开的地址栏内,如:
http://127.0.0.1:8080/Web/excel_doc/records.xls(其中一个)
文件已经正确生成,在IE中打开时能正常启动EXCEL,但有时EXCEL表格无任何数据,有时又显示正常

解决方案 »

  1.   

    顶,还有在jsp的环境下为什么打开链接有xls的文件会是乱码的
      

  2.   

    在web.xml中找到<mime-mapping>加入如下代码即可
    <mime-mapping>
    <extension>xls</extension>
    <mime-type>application/msexcel</mime-type>
    </mime-mapping>
      

  3.   

    页面中 <% 
    response.setContentType("Application/msexcel;charset=gb2312");
        String strHeader = "attachment; filename=bjd.xls" ;
        response.setHeader("Content-disposition",strHeader );
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="Application/msexcel; charset=gb2312">
    <title>报价单编制</title>
    </head>
    就可以了