Bug 45018

Summary: [PATCH] Patch to fetch embedded documents from OOXML files
Product: POI Reporter: Yury Batrakov <batrakov>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: patch file
OOXML word file with attachments
OOXML Excel file with attachments
OOXML PPoint file with attachments
updated word file
updated patch file
updated excel file
updated ppt file

Description Yury Batrakov 2008-05-16 06:53:58 UTC
Created attachment 21975 [details]
patch file

This patch provides an ability to fetch files embedded in OOXML package.
Comment 1 Nick Burch 2008-05-23 08:05:10 UTC
Thanks for this, applied to the branch

Any chance you could upload an OOXML file that contains an embeded document? That way, we'll be able to write a test to ensure it's all working properly.

(I'm leaving the bug open for now, until we get the file)
Comment 2 Yury Batrakov 2008-05-26 04:29:25 UTC
Created attachment 22003 [details]
OOXML word file with attachments
Comment 3 Yury Batrakov 2008-05-26 04:30:31 UTC
Created attachment 22004 [details]
OOXML Excel file with attachments
Comment 4 Yury Batrakov 2008-05-26 04:31:00 UTC
Created attachment 22005 [details]
OOXML PPoint file with attachments
Comment 5 Yury Batrakov 2008-05-26 04:32:11 UTC
I attached word, excel and ppoint files, once i get Visio 2007, I'll upload OOXML visio as well
Comment 6 Nick Burch 2008-05-27 05:36:09 UTC
Thanks for these files, I've added them to svn

One thing though - only the word file was coming up with attachments using your patch. Is that expected?

(Test is src/ooxml/testcases/org/apache/poi/TestEmbeded.java in the ooxml branch)
Comment 7 Yury Batrakov 2008-05-27 05:39:00 UTC
hmm, I'll have a look at that
Comment 8 Yury Batrakov 2008-05-27 06:13:20 UTC
oops, my fault. excel and powerpoint don't store OLE objects' relations in core part as word does. If noone minds me implementing this, I'll fix that
Comment 9 Nick Burch 2008-05-27 06:14:42 UTC
Go for it!
Comment 10 Yury Batrakov 2008-05-27 09:27:56 UTC
Here I am with the changes:
1. The issue was fixed
2. Also I found out that MS Office has different types for embedded OOXML files and other files. This was took into account: test documents was updated with OOXML attachments (attached) and expected file counts in test were incremented.
3. Extensions .xlsx and .pptx for test files are incorrect - looks like MSOffice chooses them for sheets and slides, but not for workbooks and presentation. Only when I changed them to xlsm and pptm, word started opening them without error messages. I changed them in test, Nick, could you also upload new files and delete old ones?
Comment 11 Yury Batrakov 2008-05-27 09:32:12 UTC
Created attachment 22012 [details]
updated word file
Comment 12 Yury Batrakov 2008-05-27 09:32:57 UTC
Created attachment 22013 [details]
updated patch file
Comment 13 Yury Batrakov 2008-05-27 09:33:33 UTC
Created attachment 22014 [details]
updated excel file
Comment 14 Yury Batrakov 2008-05-27 09:34:06 UTC
Created attachment 22015 [details]
updated ppt file
Comment 15 Yury Batrakov 2008-05-27 09:36:09 UTC
please read "could you also upload new files" as "could you also check in new files to SVN"
Comment 16 Nick Burch 2008-05-28 06:32:12 UTC
New batch committed to svn, thanks for the quick update

Hopefully you now see why we're so keen on unit tests :)
Comment 17 Yury Batrakov 2008-05-28 08:44:09 UTC
yes, i do see. that was caused by rush i was in finishing my application at my work. in future i promise to test my changes more carefully and write junit tests also :)