from docx import Document w=Document() #添加頁眉頁腳 頁眉=w.sections[0].header 段落=頁眉.paragraphs[0].add_run('這是第一節頁眉') 頁腳=w.sections[0].footer 段落=頁腳.paragraphs[0].add_run('這是一個節頁腳') #添加新頁眉頁腳(設定新的節) w.add_section() 頁眉_2=w.sections[1].header 頁眉_2.is_linked_to_previous=False #不使用上個節的內容和樣式 頁眉_a=w.sections[1].header paragraph=頁眉_a.paragraphs[0].add_run('這是第二個節的頁眉') w.save(r'E:\word練習\頁眉頁腳_5.docx')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/89928.html
標籤:Python
上一篇:學習celery時遇到的坑
