Bug 59674 - Workbook.write() corrupts non edited BIFF8 file
Summary: Workbook.write() corrupts non edited BIFF8 file
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2016-06-08 12:36 UTC by Gabriele
Modified: 2018-11-12 21:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Gabriele 2016-06-08 12:36:24 UTC
Using JDK 1.8.0_92

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

public class Main {

    public static void main(String[] args) throws IOException, InvalidFormatException {
        try (FileInputStream is = new FileInputStream(args[0]);
                Workbook wb = WorkbookFactory.create(is);
                FileOutputStream os = new FileOutputStream(File.createTempFile("test", "excel"))) {

Not working XLS https://drive.google.com/open?id=0B3S4vhAbS0W2NHYwZUtwMXI4bkk
Working XLSX https://drive.google.com/open?id=0B3S4vhAbS0W2c19jZGptMjRFaXc
Comment 1 Gabriele 2018-11-08 10:35:22 UTC
Can someone have a look at it?
Comment 2 Andreas Beeker 2018-11-12 21:05:11 UTC
I had a look at it, i.e. used your code and the non working XLS, and it works for me with the current trunk using Libre Office (Ubuntu) and Excel 2016 (Windows).