Could you try this (SXSSF only)? workBook.setZip64Mode(Zip64Mode.Never);
Some tools may not be able to handle Zip64 mode. On Thursday 10 October 2024 at 23:58:09 IST, Andreas Reichel <[email protected]> wrote: Greetings, some more insight: It seems to be a POI SXSSF problem (only). The code below creates an empty Excel file, which opens flawlessly when written as XSSF but shows corruption message when written as SXSSF. Although both files would open in Gnumeric without any problems. Now what please? Cheers Andreas package com.manticore; import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) { // this will cause corruption SXSSFWorkbook wb = new SXSSFWorkbook(new XSSFWorkbook(), 100, true, true); SXSSFSheet sheet = wb.createSheet("test"); // This will work! // XSSFWorkbook wb = new XSSFWorkbook(); // XSSFSheet sheet = wb.createSheet("test"); File outputFile = null; try { outputFile = File.createTempFile("poitest_", ".xlsx"); FileOutputStream fileOutputStream = new FileOutputStream(outputFile); wb.write(fileOutputStream); wb.close(); } catch (IOException e) { throw new RuntimeException(e); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
