Reputation: 28
I need to get the revision number of a document in Word.
I've already got the version number but I have not found a way to get the revision number yet.
Upvotes: 0
Views: 277
Reputation: 38
you can use the win32 api for python, that includes the COM module:
import win32com.client as win32
def getRevisionNumberWord(path):
word = win32.gencache.EnsureDispatch('word.application')
doc = word.Documents.Open(path, Visible = False)
props = list(doc.BuiltInDocumentProperties)
revNumber = int(props[7].value) # the "Revision number" property is the index 7 of the properties list
doc.Close()
word.Quit()
return revNumber
Upvotes: 1