Thanks. I took a more in-depth look at the POI website and used the very helpful info I got here -- I now have a java program that can scan the document for all DirectoryEntry and DocumentEntry objects. I have found that when a spreadsheet has VBA there is a _VBA_PROJECT_CUR directory entry and when a word doc has VBA, there is a Macros directory entry.
I think this should suffice for my immediate needs. Can I use this logic or is there something I am missing? This brings up another question -- if there is a spreadsheet with VBA embedded in a ppt presentation (or whatever office document type), I don't see a _VBA_PROJECT_CUR directory entry. Do I have to search the PowerPoint Document entry for this info? -----Original Message----- From: Avik Sengupta [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:53 AM To: POI Users List Subject: RE: How to Determine if a Spreadsheet Contains Macros or VBA Mike, You have to move one step above the records in the event api. An xl file contains different streams (aka documents). One stream is the workbook data, that is structured as the records you see.. the macros are kept in a separate stream. As any suggested, use the POIFS viewer to read the streams, and see what they are called. See the (o.a.p.h.usermodel.)HSSFWorkbook for an example of how to access the macro stream. See the POIFS link on the POI website for docs on the file structure. HTH. Shout if you need more. Regards - Avik On Wed, 2003-11-19 at 18:29, Rizzo, Mike wrote: > Thanks, it doesn't make sense to me yet, but that's because I need to become > more familiar with POI and the Excel file format. What I'm really trying to > do is write a servlet that will scan an office doc and let us know if there > is any kind of VB, VBA, Macros (or whatever else can be in an office doc > that can cause a dialog box to be instantiated when the doc is opened). I'd > really like to not have to write an active x control in vb or vc++ and set > up some M$ servers -- and any chance I get to use an open source solution is > one that I will pursue. But as you can tell, I'm very new to the office > document file structure and to POI -- but luckily not to Java. > > I have the event api example from the HSSF website working, could this just > be another record type that I put in the switch statement? Or is it not that > easy? > > > > > > -----Original Message----- > From: Andrew C. Oliver [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 18, 2003 4:08 PM > To: POI Users List > Subject: Re: How to Determine if a Spreadsheet Contains Macros or VBA > > > Yes. Use the (org.apache.poi.poifs.dev.)POIFSViewer to get a more specific > name -- however if I recall you can look for a node in the POIFS document > tree called "VBA_MACRO". You can look at the > (o.a.p.h.usermodel.)HSSFWorkbook source to see how we walk the tree to copy > the macros. > > Does that Make sense? > > On 11/18/03 12:10 PM, "Rizzo, Mike" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I would like to use POI to determine if a spreadsheet contains macros or > > VBA. Is this possible with POI? If so, how? > > > > Thanks, > > > > Mike Rizzo > > > > > > > > Please do not transmit orders or instructions regarding a UBS account by > > email. The information provided in this email or any attachments is not an > > official transaction confirmation or account statement. For your > protection, > > do not include account numbers, Social Security numbers, credit card > > numbers, passwords or other non-public information in your email. Because > > the information contained in this message may be privileged, confidential, > > proprietary or otherwise protected from disclosure, please notify us > > immediately by replying to this message and deleting it from your computer > > if you have received this communication in error. Thank you. > > > > UBS Financial Services Inc. > > UBS International Inc. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Please do not transmit orders or instructions regarding a UBS account by email. The information provided in this email or any attachments is not an official transaction confirmation or account statement. For your protection, do not include account numbers, Social Security numbers, credit card numbers, passwords or other non-public information in your email. Because the information contained in this message may be privileged, confidential, proprietary or otherwise protected from disclosure, please notify us immediately by replying to this message and deleting it from your computer if you have received this communication in error. Thank you. UBS Financial Services Inc. UBS International Inc. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
