from docx import Document from docx.shared import Cm 檔案=Document(r'E:\word練習\頁眉頁腳.docx') 第一節=檔案.sections[0] print("上邊距:",第一節.top_margin.cm) print("下邊距:",第一節.bottom_margin.cm) print("左邊距:",第一節.left_margin.cm) print("右邊距:",第一節.right_margin.cm) #設定頁面邊距 第一節.top_margin=Cm(5) 第一節.bottom_margin=Cm(5) 第一節.left_margin=Cm(4) 第一節.right_margin=Cm(4) 檔案.save(r'E:\word練習\設定頁邊距.docx')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/88114.html
標籤:Python
