ankita sapkal
ankita sapkal

Reputation: 11

fetching the document id

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

Answers (3)

borrel
borrel

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

Albireo
Albireo

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

Bastardo
Bastardo

Reputation: 4152

you can use file/path combination as an id, because it will be uniqe for each file on the computer.

Upvotes: 0

Related Questions