访问节的标头
>>> document = Document()
>>> section = document.sections[0]
>>> header = section.header
>>> header
<docx.section._Header object at 0x...>
与上节相链接
>>> header.is_linked_to_previous #True
添加页眉文字
>>> paragraph = header.paragraphs[0]
>>> paragraph.text = "Title of my document"
>>> paragraph = header.paragraphs[0]
>>> paragraph.text = "Left Text\tCenter Text\tRight Text"
>>> paragraph.style = document.styles["Header"]
>>> header.is_linked_to_previous = True
>>> header.is_linked_to_previous
True