Bug 62017 - Writing more than 1024 OLE objects in a single spreadsheet creates probably an invalid file
Summary: Writing more than 1024 OLE objects in a single spreadsheet creates probably a...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.17-FINAL
Hardware: PC All
: P2 normal with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-18 19:45 UTC by Ravi Wallau
Modified: 2018-01-19 18:58 UTC (History)
1 user (show)



Attachments
Contains the Excel file with 5000 OLE objects in it, and the source code of the program I've written. (391.85 KB, application/x-zip-compressed)
2018-01-18 19:45 UTC, Ravi Wallau
Details
This version of the programs writes 3072 OLE objects across 3 different sheets - the problem does not occur (34.39 KB, text/x-csrc)
2018-01-19 18:58 UTC, Ravi Wallau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi Wallau 2018-01-18 19:45:33 UTC
Created attachment 35684 [details]
Contains the Excel file with 5000 OLE objects in it, and the source code of the program I've written.

Hi:

I have attached a test program that triggers the error. Basically, this is how I trigger the error:

 - The program create more than 1024 OLE objects and anchors in an Excel sheet;
 - The generated file is opened and saved with Excel - in this process, the Excel file size shrinks;
 - When loading the Excel file, errors are thrown.

This is a sample of the error:

Failed to add a shape to the collection, row no [0], shape will be ignored [org.apache.poi.POIXMLException: Ole object not found in sheet container - it's probably a control element]
org.apache.poi.POIXMLException: Ole object not found in sheet container - it's probably a control element
	at org.apache.poi.xssf.usermodel.XSSFObjectData.getOleObject(XSSFObjectData.java:132)
	at org.apache.poi.xssf.usermodel.XSSFObjectData.getObjectPart(XSSFObjectData.java:151)
	at com.emerald_associates.spreadsheetimpexp.sketch_board.ApachePoiMultipleOleObjectsBug.lambda$testRead$0(ApachePoiMultipleOleObjectsBug.java:137)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at com.emerald_associates.spreadsheetimpexp.sketch_board.ApachePoiMultipleOleObjectsBug.testRead(ApachePoiMultipleOleObjectsBug.java:131)
	at com.emerald_associates.spreadsheetimpexp.sketch_board.ApachePoiMultipleOleObjectsBug.main(ApachePoiMultipleOleObjectsBug.java:90)

The problem occurs for each OLE object added above 1024. So if I add 1050 OLE Objects, I will get 26 errors.

I am using Apache POI 3.17, Java 8, and Excel 2017 from Office 365. To me, it appears that the file is generated with some sort of error that Excel clears up when it opens the file.

We also created a sample file where 5000 OLE objects were created with Excel - I am attaching that file here - in this example, there are no errors when the OLE objects are read with the test program.

Attached I am sending the test program I've written, and the Excel file with the 5000 OLE objects. Running the program should trigger the error, just follow the instructions on it.
Comment 1 Ravi Wallau 2018-01-19 18:34:02 UTC
This problem appears only when there are more than 1024 OLE objects in a sheet. In the new version of the test program attached, I write 1024 OLE objects in 3 different sheets (3072 in total) and the issue does not occur.
Comment 2 Ravi Wallau 2018-01-19 18:58:58 UTC
Created attachment 35689 [details]
This version of the programs writes 3072 OLE objects across 3 different sheets - the problem does not occur

Hi:

This version writes the notebook contents across 3 sheets, with 3072 OLE objects in total - the issue does not occur here, which means that the problem occurs only with more than 1024 objects in a single sheet.