D
dwotx
I am trying to read some Worrd 2003 documents (using Word 2007 automation)
from the web and determine their last modification dates. I'm wondering if
anyone has a simpler way than I've been able to figure out.
First, I have to download the file in question to a temporary file as I've
been unable to figure out how to get Word automation to read an incoming
document from a stream. It's open method seems to accept a path name only
(not a URL). The process of saving the document to a temporary file means
there are creation dates/modification dates *associated* with the file, but
the internal info in the WordML is of course unchanged.
Next, I create an instance of ApplicationClass and use that to open a new
document giving it the pathname to the temp file. Presumably, Word does not
substitute a creation/modification date taken from the file system during
this process, but I actually don't know.
Next, I want to use an xsl transform to search the WordML and pick out the
revision date, creation date, etc. The transform is easy to write, but
unfortunately, I maintain it as an embedded resource in my VS Project. That
in turn means that I reference it using the Assembly.GetExecutingAssembly
method followed by the GetManifestResourceMethod to get the file I want.
Sadly, that to provides a stream and Word's TransformDocument method again
only accepts a path .. you get the picture.
In any case, has someone found a better way to get the information I'm
seeking - I'd much appreciate it. Second, does anyone know for sure that
Word is not using modification dates from the file system representing the
temp file? Third, since I've not gotten to the part of running the transform
yet, I am presuming that it will run against an OpenXML view of the document
since I'm using 2007 classes (all transformation from 2003's WordML has
already been done)?
Any insights appreciated.
--Don
from the web and determine their last modification dates. I'm wondering if
anyone has a simpler way than I've been able to figure out.
First, I have to download the file in question to a temporary file as I've
been unable to figure out how to get Word automation to read an incoming
document from a stream. It's open method seems to accept a path name only
(not a URL). The process of saving the document to a temporary file means
there are creation dates/modification dates *associated* with the file, but
the internal info in the WordML is of course unchanged.
Next, I create an instance of ApplicationClass and use that to open a new
document giving it the pathname to the temp file. Presumably, Word does not
substitute a creation/modification date taken from the file system during
this process, but I actually don't know.
Next, I want to use an xsl transform to search the WordML and pick out the
revision date, creation date, etc. The transform is easy to write, but
unfortunately, I maintain it as an embedded resource in my VS Project. That
in turn means that I reference it using the Assembly.GetExecutingAssembly
method followed by the GetManifestResourceMethod to get the file I want.
Sadly, that to provides a stream and Word's TransformDocument method again
only accepts a path .. you get the picture.
In any case, has someone found a better way to get the information I'm
seeking - I'd much appreciate it. Second, does anyone know for sure that
Word is not using modification dates from the file system representing the
temp file? Third, since I've not gotten to the part of running the transform
yet, I am presuming that it will run against an OpenXML view of the document
since I'm using 2007 classes (all transformation from 2003's WordML has
already been done)?
Any insights appreciated.
--Don