How to create a POI VBAMacroReader(POIFSFileSystem fs)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to create a POI VBAMacroReader(POIFSFileSystem fs)

anthony berglas
I currently have working code that does

     pkg = OPCPackage.open(stream);
     // process worksheets in pkg...
     mr = new VBAMacroReader(stream);
     // process macros

The problem is that the first call reads stream, and the second then cannot
read it.  Work around is to create multiple BufferedInputReaders which
works but is obviously all wrong.  Why scan the pkg twice in the first
place?

What I should be doing is calling

    new VBAMacroReader(pkg.somehowGetPOIFSFileSystem())

However, it is not at all clear what somehowGetPOIFSFileSystem() should be.
(I only have a stream as source, not a file, it is coming over the
network.  Only needs to work for .xlsm, not .xls.  But obviously the macro
part is binary.)
Any help appreciated.

Anthony

--

Dr Anthony Berglas, [hidden email]       Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that that is the best way to collect firewood.