小编Tay*_*sir的帖子

使用 python-docx 在 Word 文档页眉中添加徽标

我希望每次运行代码时在 Word 文档中附加一个徽标文件,

理想情况下,代码应如下所示:

from docx import Document
document = Document()
logo = open('logo.eps', 'r')                  #the logo path that is to be attached
document.add_heading('Underground Heating Oil Tank Search Report', 0) #simple heading that will come bellow the logo in the header.
document.save('report for xyz.docx')              #saving the file
Run Code Online (Sandbox Code Playgroud)

这在 python-docx 中可能吗?还是我应该尝试其他库来做到这一点?如果可能的话请告诉我怎么做

python-3.x python-docx

4
推荐指数
2
解决办法
7490
查看次数

标签 统计

python-3.x ×1

python-docx ×1