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!
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static enum | |
| protected static class | |
| protected static class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private POIFSFileSystem | |
| private static final int | |
| private static final Logger | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| protected static final String | |
| protected static final String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| private static byte[] | Returns: uncompressed bytes if found,null otherwisefull module inputstream to read is)Sometimes the offset record in the dirstream is incorrect, but the macro can still be found. |
| protected void | findMacros(DirectoryNode
The directory of entries to look at dir, VBAMacroReader.The resulting map of modules modulesRecursively traverses directory structure rooted at |
| protected void | findModuleNameMap(DirectoryNode node, Map<String, String> moduleNameMap, VBAMacroReader.
|
| protected void | findProjectProperties(DirectoryNode node, Map<String, String> moduleNameMap, VBAMacroReader.
|
| private VBAMacroReader. | |
| private void | |
| private void | |
| public Map | |
| public Map | Returns: All the macros and their contentsReads all macros from all modules of the opened office file. |
| protected void | readMacros(DirectoryNode macroDir, VBAMacroReader.
Reads VBA Project modules from a VBA Project directory located at
|
| private static String | |
| private static void | readModuleFromDocumentStream(DocumentNode documentNode, String name, VBAMacroReader.
|
| private static void | readModuleMetadataFromDirStream(RLEDecompressingInputStream
the run-length encoded input stream to read from in, String the stream name of the module streamName, VBAMacroReader.a map to store the modules modulesreads module from DIR node in input stream and adds it to the modules map for decompression later on the second pass through this function, the module will be decompressed Side-effects: adds a new module to the module map or sets the buf field on the module to the decompressed stream contents (the VBA code for one module) |
| protected void | |
| protected void | readProjectProperties(DocumentInputStream dis, Map<String, String> moduleNameMap, VBAMacroReader.
|
| private static String | Returns: a java String in the supplied character setthe inputstream to read from stream, int number of bytes to read from stream length, Charset the character set encoding of the bytes in the stream charset)Read |
| private VBAMacroReader. | |
| private VBAMacroReader. | readStringPair(RLEDecompressingInputStream in, Charset charset, int reservedByte, boolean throwOnUnexpectedReservedByte)
|
| private static String | |
| private String | |
| private static void | trySkip(InputStream in, long n)
Skips |
| private static byte[] |