Bug 61734 - Error after writing XLSM file via XSSFWorkbook - file read via XSSFWorkbook before
Summary: Error after writing XLSM file via XSSFWorkbook - file read via XSSFWorkbook ...
Status: RESOLVED DUPLICATE of bug 60977
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.17-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-07 11:51 UTC by Uwe Herrmann
Modified: 2018-04-19 08:48 UTC (History)
0 users



Attachments
Source code to create the error (3.60 KB, text/plain)
2017-11-07 11:51 UTC, Uwe Herrmann
Details
Original Excel - file to create the error (152.60 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-11-07 12:55 UTC, Uwe Herrmann
Details
The erroneous Excel file created by original file and source code (140.46 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-11-07 12:57 UTC, Uwe Herrmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Uwe Herrmann 2017-11-07 11:51:06 UTC
Created attachment 35501 [details]
Source code to create the error

Hi,

I am using POI 3.17 final to read an Excel Macro file (xlsm).
There is no error during reading of the file.

Afterwards I read some sheets data and write this workbook back to file.
(there is no error during writing to a file, too.)

The written file is now corrupt and Excel, start with Version 20007, must repair the file.

Message: Excel has found unreadable content in file XXX Do you like to repair the Workbook? (Sorry this may be not the original english message, because i use the german Version of Excel). 

Excel try to repair this file and remove some Content.

See attachment for examples. The BugDemo-OUT.xlsm file is corrupt.

source code to test is attached, too.

Thanks in advance for your help.

Regards,

Uwe Herrmann
Comment 1 Uwe Herrmann 2017-11-07 12:55:33 UTC
Created attachment 35502 [details]
Original Excel - file to create the error

Please use the source code and this file to create the erroneous file
Comment 2 Uwe Herrmann 2017-11-07 12:57:28 UTC
Created attachment 35503 [details]
The erroneous Excel file created by original file and source code

This file will be created by source code and original Excel Macro file
Comment 3 Javen O'Neal 2017-11-07 16:24:23 UTC
As a workaround, if you're not modifying the Workbook, can you open it in read only more via the OPCPackage class?
Comment 4 Uwe Herrmann 2017-11-08 08:07:17 UTC
Dear Mr. Javen O'Neal,

alas it is not possible for me.
As you can see in my appended source code 
(method speichereFormularVorlageDaten) , 
i need this to store an additional custom property in the excel macro file. 

Originally, i use a ByteArrayInputStream to read the file by dint of application Server.

The problem seems to be the ListObject inside the Excel macro file.
This is an extension to a QueryTable - Object since Excel 2007. Since an update of Office, the QueryTable - Object will automatically changed to the ListObject.
It is not possible to reverse this automatically change anymore.

Up to now i could not find the cause update.

Best regards

Uwe Herrmann
Comment 5 Dominik Stadler 2017-12-27 21:04:33 UTC
Can you also attach the original file so we can re-run the test-case with it to reproduce the problem?
Comment 6 Uwe Herrmann 2018-01-03 11:32:22 UTC
Dear Dominik Stadler,

you already find an attached file called BugDemo.xlsm to reproduce the error.
The error occurs after you rewrite the file with POI, as you can see by the first attachment. 

See also Attachments Original Excel - file to create the error.

Thanks in advance for your help!

Regards 

Uwe Herrmann
Comment 7 Dominik Stadler 2018-04-19 08:48:34 UTC
This is actually a duplicate of bug 60977

*** This bug has been marked as a duplicate of bug 60977 ***