Bug 60162 - VBAMacroReader misses macro in one test ppt
Summary: VBAMacroReader misses macro in one test ppt
Status: RESOLVED DUPLICATE of bug 59302
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-22 01:07 UTC by Tim Allison
Modified: 2016-10-19 11:59 UTC (History)
0 users



Attachments
file from TIKA-2069 (86.00 KB, application/vnd.ms-powerpoint)
2016-09-22 01:07 UTC, Tim Allison
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Allison 2016-09-22 01:07:48 UTC
Created attachment 34289 [details]
file from TIKA-2069

While working on TIKA-2069, I found that I wasn't able to extract macros from a test ppt file that I generated.  May be user error in generating the test file.  However, POI successfully extracted macros from the original 'pptm' file that I saved as ppt.
Comment 1 Tim Allison 2016-09-22 01:09:35 UTC
"Sub Embolden()" and "Sub Italicize" should show up in the text of the macros.
Comment 2 Tim Allison 2016-10-18 17:45:37 UTC
The macros are stored in a POIFS within an ExOleObjStg within the "PowerPoint Document".  Brilliant!!! 

If you add this to the end of buildRecords() in HSLFSlideShowImpl:

        for (Record r : _records) {
            if (r.getRecordType() == 4113) {
                ExOleObjStg exOleObjStg = (ExOleObjStg) r;
                try {
                    NPOIFSFileSystem npoifs = new POIFSFileSystem(exOleObjStg.getData());
                    VBAMacroReader reader = new VBAMacroReader(npoifs);
                    System.out.println(reader.readMacros());
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }
        }

The macros are correctly read.

Recommendations for the least smelly way to extract these?  Unlike the other document formats, this requires a full parse of the document, we can't just pass in the parent POIFs.

Add a getMacros() to HSLFSlideShowImpl for now?
Comment 3 Tim Allison 2016-10-18 17:54:48 UTC
As always, Yegor had already figured this out:

https://bz.apache.org/bugzilla/show_bug.cgi?id=43376

:)
Comment 4 Tim Allison 2016-10-19 11:59:28 UTC
Y, so it wasn't just Yegor, but just about the entire POI team already knew this...

Thanks to Javen for pointing 59302 out to me.  Sorry for the duplicate!

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