Reputation: 19
I have some Office files... . I want to upload these files into Data Base... Before uploading i want to check the files are macro enabled or not... Expecting the solution in java script...
I have tried with the following file extensions..
".docm",".dotm",".xlm ",".xltm",".xlsm",".xla",".xlam",".pptm",".potm",".ppsm",".sldm",".ppam",".accde"
but i need to know any other way to find the solution in JS or C#,
by processing the file content and check any programming contents inside it..
these are the codes i tried...
var extnsnArray=[".docm",".dotm",".xlm",".xltm",".xlsm",".xla",".xlam",".pptm",".potm",".ppsm",".sldm",".ppam",".accde"]
var extnsn = $(file).attr('extension');
if (extnsnArray.indexOf(extnsn) > -1)
{
// file is macro enabled
}
else
{
// file is not macro enabled
}
Upvotes: 2
Views: 502
Reputation: 14809
In the case of PowerPoint, any PPTM, PPSM, POTM, PPAM file either contains macros or is some other type of file that's been given the wrong extension, in which case PowerPoint won't open it.
PPT files may or may not contain macros, making things more complicated if you need to look at them.
Upvotes: 1