Reputation: 11
How do I fetch the document id of an open document in Word? I need that doc id to upload the opened document to a server. Can I do this by creating an instance of that document and use some property?
Upvotes: 1
Views: 236
Reputation: 932
you need ActiveDocument
from the Word.Application
something like (c# is a long time ago for me)
var word = Word.Application;
var doc = word.ActiveDocument;
provided you have office library's loaded
Upvotes: 1
Reputation: 11095
You can also hash the document and use the hash as ID, using a good hashing algorithm like SHA512 will guarantee a unique ID for every document.
Upvotes: 1
Reputation: 4152
you can use file/path combination as an id, because it will be uniqe for each file on the computer.
Upvotes: 0