XLS/XLSX not opening in IPAD/Safari created with APACHE POI

I developed a download functionality in a web application where a user can download selected records in excel file or in text file.

  • For download in excel I have used Apache POI and using SXSSFWorkbook class for writing.
  • For download in Text file I have used java IO.
  • Everything is working fine in windows (All browsers) but in IPAD (Safari) download in excel functionality is not opening, saying unable to read document (An error occurred while reading the file). However, text download is working fine.

    I goggled and found it might be due to some encryption in the file. Then I have changed the file extension from "xls" to "xlsx". But still its not working.

    Is there any limitation with APACHE POI API? Because, I am able to open a normal xls/xlsx file in IPAD but not the programmaticaly created once.

    Setting mime mappings in web.xml -

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

    Also, in weblogic config we have mimemappings.properties.

    链接地址: http://www.djcxy.com/p/46884.html

    上一篇: PHP

    下一篇: XLS / XLSX无法在使用APACHE POI创建的IPAD / Safari中打开