Added support for the sub-record which stores the embedded object IDs. Added usermodel API for getting access to the embedded object's data.
Created attachment 20716 [details] Patch to add embedded object support to HSSF
Created attachment 20717 [details] Test file for OLE2 embedding in an XLS file. Attaching test file. Unit test code: (there is a tiny amount of our framework in it to locate the file, should be easily removed. /** * Tests that embedded objects are accessible. * * @throws Exception if an error occurs. */ public void testEmbeddedObjects() throws Exception { File file = getDataFile("office/ole2-embedding.xls"); HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file)); List objects = workbook.getAllEmbeddedObjects(); assertEquals("Wrong number of objects", 2, objects.size()); assertEquals("Wrong name for first object", "MBD06CAB431", ((HSSFObjectData) objects.get(0)).getDirectory().getName()); assertEquals("Wrong name for second object", "MBD06CAC85A", ((HSSFObjectData) objects.get(1)).getDirectory().getName()); }
Turns out this breaks something else, working on version 2.
Created attachment 20734 [details] Patch version 2 Here's the fixed version... it doesn't break the sheets, and is simpler than the original anyway.
Patch applied. Thanks for it. I will not close this bug for the same reason as Bug 43222 - it lacks unit tests. Please provide at least a unit test for EmbeddedObjectRefSubRecord. Also, dropping a line in the HSSF quick guide won't harm. Regards, Yegor
Unit tests were added. The bug can be closed. Yegor