In C# I create a file in the temp folder named “MyDoc.docx”
I then start the Word process with this file.
Using a FileSystemWatcher I monitor for file changes, and I also monitor when the Word process exits.
I would like to read the changes made tot he document.
However, Word is using a different file name than what I provided. It is using a short (8.3) file name. However, it is not using what I calculate the short file name should be — it seems that Word is using it’s own temporary file name.
How can I determine that my file has changed? How can I know the name of the file Word is using?
Any thoughts?
ANSWER:
Instead of handling changed events for Word files, Renamed events should be handled. When Word saved its document, it saves its temp file and then copies it to the original file name.
Instead of handling changed events for Word files, Renamed events should be handled. When Word saved its document, it saves its temp file and then copies it to the original file name.