简体   繁体   English

使用Python在Word中查找和替换脚注

[英]Using Python to find and replace footnotes in word

I am trying to use Python to hyperlink text in MS Word documents. 我正在尝试使用Python将MS Word文档中的文本超链接。 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). 我目前正在使用win32com模块,但是我对如何从脚注中获取文本(以及如何添加超链接)有些困惑。

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. 我已经尝试从以下网站读取内容: https : //msdn.microsoft.com/zh-cn/library/kw65a0we( VS.80) .aspx https://msdn.microsoft.com/en-us/library/bb179107(v = office.12).aspx ,以查看该命令可能是什么。

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://msdn.microsoft.com/zh-cn/library/office/ff845743.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM