1

Is there a way to extract the comment content and the referenced text without using COM? I provided a working solution below, but looking to do this without COM.

The solution below was provided by Extract DOCX Comments

word = win32.gencache.EnsureDispatch('Word.Application')
word.Visible = False 

comments = []
doc = word.Documents.Open(report_path)
doc.Activate()
active_doc = word.ActiveDocument
for c in active_doc.Comments: 
        if c.Ancestor is None:
            comments.append([c.Scope.Text, c.Range.Text])
doc.Close()
Finntech
  • 105
  • 6

0 Answers0