Re: Checking hidden macro in Open-XML
- From: "Han" <hp4444@xxxxxxxxxxxxxxxx>
- Date: Sun, 19 Aug 2007 17:41:54 +0900
OOPS, wrong post. Ignore it. Sorry.
"Han" <hp4444@xxxxxxxxxxxxxxxx> wrote in message
news:OC8dfxj4HHA.5804@xxxxxxxxxxxxxxxxxxxxxxx
Hello
How do you find a hidden macro in .xlsx document?
You can't save a document with a macro as .xlsx. I can audit the extension
in server to block documents with macro.
However, users can save a document as .xlsm, rename it as .xlsx, and
upload the file into the server. The uploaded stream works well as legal
open-xml like any other clean .xlsx files.
The macro within .xlsx will not work as far as the file extension stays
same. And the renamed file will not even opened when you execute it. But
not that in open-xml files servers. I think there can be some dangers
here.
I want to check the macro in .xlsx file on my server. Currently I am
checking workbookpart.
spreadsheetdocument sdoc=spreadsheetdocument.open(file-stream, false);
workbookpart wbp=sdoc.workbookpart;
xmldocument.load(wbp.getstream());
if (xmldocument.selectsinglenode("/*/ns1:fileVersion/@codeName", nsmgr) !=
null)
throw(new Exception("Hey, why do you insert macro in .xlsx file?"));
However I believe there is a better way to find a macro. Something like
HasVBProject property in VBA.
.
- References:
- Checking hidden macro in Open-XML
- From: Han
- Checking hidden macro in Open-XML
- Prev by Date: Checking hidden macro in Open-XML
- Next by Date: Re: XML Heck
- Previous by thread: Checking hidden macro in Open-XML
- Index(es):