Re: All my POI built Excel files are suddenly corrupt?
Andreas Reichel <[email protected]> Fri, 11 Oct 2024 06:13:19 +0700
| Newsgroups | gmane.comp.jakarta.poi.user |
|---|---|
| Organization | manticore-projects Co. Ltd. |
| Message-ID | <be069eb68029f9fca36b07f5397888ba1ce8b017.camel@manticore-projects.com> |
--=-DTkV/TjDkgxUPkjt1Dtw
Content-Type: text/plain; charset="ISO-8859-15"
Content-Transfer-Encoding: quoted-printable
On Thu, 2024-10-10 at 23:03 +0000, PJ Fanning wrote:
> workBook.setZip64Mode(Zip64Mode.Never);
>
> Some tools may not be able to handle Zip64 mode.
You are my hero! The following works and no corruption.
Please don't allow/set Zip64Mode.Never, it will hang forever and is
hard to kill.
Now, who is to blame and where to report this problem to? Is is Commons
Compress or LibreOffice?
Thank you so much for the hint and help!
public class Main {
public static void main(String[] args) {
// this will cause corruption
SXSSFWorkbook wb =3D new SXSSFWorkbook(new XSSFWorkbook(), 100, t=
rue, true);
SXSSFSheet sheet =3D wb.createSheet("test");
wb.setZip64Mode(Zip64Mode.AlwaysWithCompatibility);
File outputFile =3D null;
try {
outputFile =3D File.createTempFile("poitest_", ".xlsx");
FileOutputStream fileOutputStream =3D new FileOutputStream(out=
putFile);
wb.write(fileOutputStream);
wb.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
--=-DTkV/TjDkgxUPkjt1Dtw--