Using Python to find and replace footnotes in word

女生的网名这么多〃 提交于 2021-01-28 12:16:59

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!