Determine if document to open is a "real" Word Document

B

bqsoftware

I am trying to determine if a document is truly a word document before I open
it. I do not want any autoconversions on Excel Spreadshets, JPGs etc. I
really only want to verify that the document is truly a word document before
I open it. Do I need to check the binary first?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?YnFzb2Z0d2FyZQ==?=,
I am trying to determine if a document is truly a word document before I open
it. I do not want any autoconversions on Excel Spreadshets, JPGs etc. I
really only want to verify that the document is truly a word document before
I open it. Do I need to check the binary first?
Possibly - no guarantees here, you'll have to do some testing - you can check
the Office document properties, using the DSOFile tool:

support.microsoft.com/default.aspx?scid=kb;en-us;224351

Link to d/l
support.microsoft.com/default.aspx?scid=kb;EN-US;q253338

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
T

Tony Jollans

I guess it depends on how certain you want to be, and maybe what it is
you're trying to avoid; how often are .doc extensions not Word documents in
your environment, and vice-versa?

I think DSOFile should give you the application name but it differs from
version to version - and is editable so could, in theory, be anything.

I suspect you could, again in theory, pick up the 'magic number' from the
binary but what about RTF or XML files which could be valid Word documents?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top