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')
本文版权归趣营销www.SEOgUrublog.com 所有,如有转发请注明来出,竞价开户托管,seo优化请联系QQ卍61910465