Compare/Diff two word files and create a result PDF

import win32com.client
import time

app = win32com.client.Dispatch('Word.Application')

# The original document:
doc = app.Documents.Open('c:\\temp\\firstversion.doc')
# The modified document:
ret = doc.Compare('c:\\temp\\newversion.doc')

app.ActiveDocument.SaveAs('diff.doc')
app.ActiveDocument.ExportAsFixedFormat('diff.pdf', 17, False, 0, 0, 1, 1, 7, True, True, 1, True, True, True)
app.ActiveDocument.Close()
doc.Close()
app.Quit()

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.