在除第一页以外的所有页面上添加页眉和页脚?

Add Header and Footer on all the pages except the first page?

python-docx 库是否可以在除第一页之外的整个文档中插入页眉和页脚?

是:

section = document.sections[0]
section.different_first_page_header_footer = True
header = section.header

此设置是特定于章节的,因此如果您的文档中有多个章节(很可能没有),那么您需要为每个您想要的章节设置 .different_first_page_header_footer行为。

在此之后,您还可以访问不同的首页页眉或页脚:

first_page_header = section.first_page_header
first_page_footer = section.first_page_footer