from docx import Document from docx.shared import Cm from docx.enum.table import WD_TABLE_ALIGNMENT #設定表格對齊方式 w=Document(r'D:\word練習\練習.docx') table=w.tables[0] table.alignment=WD_TABLE_ALIGNMENT.LEFT #左對齊 #設定表格寬度 for col in table.columns: for cell in col.cells: cell.width=Cm(3) #設定表格高度 for row in table.rows: for cell in row.cells: cell.height=Cm(3) w.save(r'D:\word練習\練習_1.docx')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/96425.html
標籤:Python
下一篇:django框架效率
