Package org.apache.poi.poifs.macros
Class VBAMacroReader
- java.lang.Object
-
- org.apache.poi.poifs.macros.VBAMacroReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class VBAMacroReader extends Object implements Closeable
Finds all VBA Macros in an office file (OLE2/POIFS and OOXML/OPC), and returns them.
NOTE: This does not read macros from .ppt files. See org.apache.poi.hslf.usermodel.TestBugs.getMacrosFromHSLF() in the scratchpad module for an example of how to do this. Patches that make macro extraction from .ppt more elegant are welcomed!
- Since:
- 3.15-beta2
-
-
Constructor Summary
Constructors Constructor Description VBAMacroReader(File file)VBAMacroReader(InputStream rstream)VBAMacroReader(POIFSFileSystem fs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Map<String,Module>readMacroModules()Map<String,String>readMacros()Reads all macros from all modules of the opened office file.
-
-
-
Constructor Detail
-
VBAMacroReader
public VBAMacroReader(InputStream rstream) throws IOException
- Throws:
IOException
-
VBAMacroReader
public VBAMacroReader(File file) throws IOException
- Throws:
IOException
-
VBAMacroReader
public VBAMacroReader(POIFSFileSystem fs)
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
readMacroModules
public Map<String,Module> readMacroModules() throws IOException
- Throws:
IOException
-
readMacros
public Map<String,String> readMacros() throws IOException
Reads all macros from all modules of the opened office file.- Returns:
- All the macros and their contents
- Throws:
IOException- Since:
- 3.15-beta2
-
-