• 欢迎光临~

python docx学习笔记 页眉和页脚 Headers Footers

开发技术 开发技术 2022-05-23 次浏览

header

  1. 访问header
#1.访问header
header = section.header
#2.设置是否同上一节相同
header.is_linked_to_previous=True
#3.新增header,此时is_linked_to_previous属性自动改为False
paragraph = header.paragraphs[0]
paragraph.text = "Title of my document"
#4.添加多列header
paragraph = header.paragraphs[0]
paragraph.text = "Left TexttCenter TexttRight Text"
paragraph.style = document.styles["Header"]
程序员灯塔
转载请注明原文链接:python docx学习笔记 页眉和页脚 Headers Footers
喜欢 (0)