简体   繁体   中英

Using Python to find and replace footnotes in word

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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