位置:首頁 > 軟件操作教程 > 編程開發(fā) > Python > 問題詳情

設(shè)置單元格對齊方式在python中如何操作?

提問人:楊紫紅發(fā)布時間:2020-11-18

alignment = xlwt.Alignment()    #創(chuàng)建alignment

alignment.horz = xlwt.Alignment.HORZ_CENTER   #設(shè)置水平對齊為居中,May be: HORZ_GENERAL, HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED, HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED

alignment.vert = xlwt.Alignment.VERT_CENTER   #設(shè)置垂直對齊為居中,May be: VERT_TOP, VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED

style3.alignment = alignment   #應(yīng)用alignment到style3上

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部