Note that there are some explanatory texts on larger screens.

plurals
  1. POunreadable content error with apache POI 3.8
    text
    copied!<p>I'm using Apache POI 3.8. I have a JSP that generates an excel (.xslx) file. I developed it locally and the file could be opened without any problems. Then, I deployed the app in the Dev environment and when I open the generated excel file there, a warning box comes up saying: "Excel found unreadable content in ausencias.xlsx. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes." If I click Yes, then the following alert appears: "This file cannot be opened by using Microsoft Excel. Do you want to search the Microsoft Office Online Web site for a converter that can open the file?" If I click No, the file is correctly opened. But I don't know why I get these errors.</p> <p>It happens even if I generate a simple empty .xslx file:</p> <pre><code>&lt;%@page import="java.io.FileOutputStream"%&gt; &lt;%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%&gt; &lt;%@page import="java.io.IOException"%&gt; &lt;%@page import="javax.servlet.*"%&gt; &lt;%@page import="org.apache.poi.ss.usermodel.*"%&gt; &lt;%@page import="org.apache.poi.ss.util.CellRangeAddress"%&gt; &lt;%@page import="org.apache.poi.xssf.usermodel.*"%&gt; &lt;% response.setHeader ("Content-Disposition", "attachment;filename=\"ausencias.xlsx\""); response.setContentType("application/vnd.ms-excel"); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("Ausencias"); ServletOutputStream fout = response.getOutputStream(); wb.write(fout); fout.flush(); fout.close(); %&gt; </code></pre> <p>In my local machine, I have Microsoft Office Excel 2007 (12.0.6661.5000) SP2 MSO (12.0.6562.5003) In the Dev environment, I have Microsoft Office Excel 2007 (12.0.6611.1000) SP3 MSO (12.0.6607.1000)</p> <p>Does anyone know a solution or a workaround?</p> <p>Thanks.</p> <p>EDIT: I have added the whole JSP code. I am aware that some imports may not be used; I just left them there when I cropped my original code looking for the problem.</p> <p>EDIT 2: I have opened in my local machine the document generated in the development environment and it throws the same warnings. So the problem is in the file, not in the Excel version. It seems like something is tampering with the file in the Dev Env. Any ideas??</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload