我想用python-docx在页脚或页眉添加一个标志(jpg或png格式的图片)。
有什么方法可以做到这一点吗?
添加一个运行,并在运行中添加一个图片。
document = Document()
section = document.sections[0]
header = section.header
paragraph = header.paragraphs[0]
run = paragraph.add_run()
run.add_picture("my-image.png")
更多关于页眉和页脚的文档在这里。https:/python-docx.readthedocs.ioenlatestuserhdrftr.html。