Hi Andreas,

I did a quick check and can state the following:
* It happens for me as well with your code snippet
* It does not depend on the version of POI, all versions from 3.17 - 5.3.0
lead to the same
* LibreOffice does not complain for the file
* When I create a sheet as part of the code, the problem goes away

So it seems Excel complains when there is no sheet at all in the file.

Might this be the case in your application in some cases? Or is there
something else which is not covered in the test-case yet?

*BTW, the sample file did not make it through the mailing-list...*

Regards... Dominik.



On Thu, Oct 10, 2024 at 6:53 AM Andreas Reichel <
[email protected]> wrote:

> Greetings team and compliments of the day.
>
> Since a few month, all our POI-built Excel files are corrupted when
> opening in LibreOffice and/or Excel:
>
>
> Although the file can be repaired and opened without any noticeable damage.
> The weird thing is: Our Excel export code as not changed at all since, and
> all the Excel files fail even from various, different and independent code
> paths. Also tested on different machines.
>
> I have also checked, how we write and close those files -- it looks all
> innocent and normal to me:
>
> SXSSFWorkbook wb  = new SXSSFWorkbook(new XSSFWorkbook(), 100, true, true);
>
> File outputFile = File.createTempFile("test", ".xlsx");
>
> FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
> wb.write(fileOutputStream);
> wb.close();
>
>
> So I don't even know where/what to look for?
>
> Can you give me some advise how to trace this problem. I have attached
> such an Excel, just in case.
> The used libraries and dependencies are shown below.
>
> Any hint would be much appreciated!
> Thank you, all the best and cheers
>
> Andreas
>
>
>    -
>    - *com.github.pjfanning:excel-streaming-reader:5.0.2*
>    - *commons-codec:commons-codec:1.17.1 *
>    - *commons-io:commons-io:2.17.0 *
>    - commons-logging:commons-logging:1.3.2
>    - org.apache.commons:commons-collections4:4.5.0-M2
>    - *org.apache.commons:commons-compress:1.27.1 (*) *
>    - org.apache.commons:commons-configuration2:2.11.0
>    - *org.apache.commons:commons-lang3:3.17.0 *
>    - org.apache.commons:commons-math3:3.6.1
>    - org.apache.commons:commons-text:1.12.0 (*)
>    - *org.apache.poi:poi-ooxml:5.3.0 *
>    - *org.apache.poi:poi:5.3.0 *
>    -
>
>
>

Reply via email to