位置:首页 > 软件操作教程 > 编程开发 > Python > 问题详情

设置单元格对齐方式在python中如何操作?

提问人:杨紫红发布时间:2020-11-18

alignment = xlwt.Alignment()    #创建alignment

alignment.horz = xlwt.Alignment.HORZ_CENTER   #设置水平对齐为居中,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   #设置垂直对齐为居中,May be: VERT_TOP, VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED

style3.alignment = alignment   #应用alignment到style3上

继续查找其他问题的答案?

相关视频回答
回复(0)
返回顶部