Bug 60162

Summary: VBAMacroReader misses macro in one test ppt
Product: POI Reporter: Tim Allison <tallison>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Attachments: file from TIKA-2069

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 ***