使用Python在word中查找和替换脚注 [英] Using Python to find and replace footnotes in word
问题描述
我正在尝试使用 Python 来超链接 MS Word 文档中的文本.我目前正在使用 win32com 模块,但我对如何从脚注中获取文本(以及如何添加超链接)感到有些困惑.
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).
我尝试阅读以下内容:https://msdn.microsoft.com/en-us/图书馆/kw65a0we(VS.80).aspxhttps://msdn.microsoft.com/en-us/library/bb179107(v=office.12).aspx努力看看命令可能是什么.
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.
推荐答案
使用
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)
更多详细信息,请访问 https://msdn.microsoft.com/en-us/library/office/ff845743.aspx.
More details at https://msdn.microsoft.com/en-us/library/office/ff845743.aspx.
这篇关于使用Python在word中查找和替换脚注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!