【发布时间】:2021-06-25 11:24:27
【问题描述】:
我正在尝试使用 Python 的 docx 模块在 MS Word 文档中添加超链接。
我到处搜索(官方文档、StackOverflow、Google),但一无所获。
我想做这样的事情:
from docx import Document
document = Document()
p = document.add_paragraph('A plain paragraph having some ')
p.add_hyperlink('Link to my site', target="http://supersitedelamortquitue.fr")
有人知道怎么做吗?
【问题讨论】:
-
是的,这是可能的。 github.com/python-openxml/python-docx/issues/384查看最后一个答案。
-
谢谢。我怎么忘记查github了,骗我!!
标签: python python-docx