Bug 43222 - [PATCH] Support for getting OLE objects from HSSFWorkbook
Summary: [PATCH] Support for getting OLE objects from HSSFWorkbook
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: Other other
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Keywords: PatchAvailable
Depends on:
Reported: 2007-08-27 21:08 UTC by Trejkaz (pen name)
Modified: 2008-01-24 23:11 UTC (History)
0 users

Patch to add embedded object support to HSSF (19.10 KB, patch)
2007-08-27 21:09 UTC, Trejkaz (pen name)
Details | Diff
Test file for OLE2 embedding in an XLS file. (40.50 KB, application/octet-stream)
2007-08-27 21:17 UTC, Trejkaz (pen name)
Patch version 2 (14.85 KB, patch)
2007-08-29 18:34 UTC, Trejkaz (pen name)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trejkaz (pen name) 2007-08-27 21:08:52 UTC
Added support for the sub-record which stores the embedded object IDs.  Added
usermodel API for getting access to the embedded object's data.
Comment 1 Trejkaz (pen name) 2007-08-27 21:09:23 UTC
Created attachment 20716 [details]
Patch to add embedded object support to HSSF
Comment 2 Trejkaz (pen name) 2007-08-27 21:17:41 UTC
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",
	assertEquals("Wrong name for second object", "MBD06CAC85A",
Comment 3 Trejkaz (pen name) 2007-08-29 18:09:55 UTC
Turns out this breaks something else, working on version 2.
Comment 4 Trejkaz (pen name) 2007-08-29 18:34:38 UTC
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.
Comment 5 Yegor Kozlov 2007-09-08 09:40:37 UTC
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.   

Comment 6 Yegor Kozlov 2008-01-24 23:11:21 UTC
Unit tests were added. The bug can be closed.