Package org.apache.poi.poifs.macros
Class VBAMacroReader
- java.lang.Object
-
- org.apache.poi.poifs.macros.VBAMacroReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class VBAMacroReader extends java.lang.Object implements java.io.CloseableFinds 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(java.io.File file)VBAMacroReader(java.io.InputStream rstream)VBAMacroReader(POIFSFileSystem fs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.util.Map<java.lang.String,Module>readMacroModules()java.util.Map<java.lang.String,java.lang.String>readMacros()Reads all macros from all modules of the opened office file.
-
-
-
Constructor Detail
-
VBAMacroReader
public VBAMacroReader(java.io.InputStream rstream) throws java.io.IOException- Throws:
java.io.IOException
-
VBAMacroReader
public VBAMacroReader(java.io.File file) throws java.io.IOException- Throws:
java.io.IOException
-
VBAMacroReader
public VBAMacroReader(POIFSFileSystem fs)
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
readMacroModules
public java.util.Map<java.lang.String,Module> readMacroModules() throws java.io.IOException
- Throws:
java.io.IOException
-
readMacros
public java.util.Map<java.lang.String,java.lang.String> readMacros() throws java.io.IOExceptionReads all macros from all modules of the opened office file.- Returns:
- All the macros and their contents
- Throws:
java.io.IOException- Since:
- 3.15-beta2
-
-