How can I check a word template file. It can be checked using the extension .dot or .dotx.
But if the user changed a .txt to .dot. How could it identified??
How can I check a word template file. It can be checked using the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To check for a dotx file (which is actually a zip file), check the header:
First four bytes are 0x050 0x4b 0x03 0x04. This will demonstrate if a file is a zip file (so not necessarily a dotx), if you wanted to checked further your would need to unzip the entire buffer and parse the resulting XML.
To check for a dot file (pre 2007), check the header:
First eight bytes 0xd0 0xcf 0x11 0xe0 0xa1 0xb1 0x1a 0xe1
So for either of these cases, open the file in binary mode, read the first eight bytes and compare.