问题
I am trying to use Python to hyperlink text in MS Word documents. I am currently using the win32com module, but I have become a little stuck on how to get the text from footnotes (and how to add a hyperlink).
I have tried reading stuff from: https://msdn.microsoft.com/en-us/library/kw65a0we(VS.80).aspx https://msdn.microsoft.com/en-us/library/bb179107(v=office.12).aspx In an effort to see what the command might be.
回答1:
Use
footnotes = ActiveDocument.StoryRanges(wdFootnotesStory)
footnotes.Find.Execute(FindText="Microsoft Word", Forward=True)
while footnotes.Find.Found:
...do something, then:
footnotes.Find.Execute(FindText="Microsoft Word", Forward=True)
More details at https://msdn.microsoft.com/en-us/library/office/ff845743.aspx.
来源:https://stackoverflow.com/questions/34834338/using-python-to-find-and-replace-footnotes-in-word