设置exce对齐方式
- xlwt.Alignment() #创建对齐对象
- xlwt.Alignment().horz #水平对齐
- xlwt.Aligenment().vert #垂直对齐 实际上,水平也分为居中对齐、左对齐、右对齐等等;垂直对齐也分为上对齐、下对齐,居中对齐等等。具体如下:
水平对齐
- HORZ_GENERAL = 0x00
- HORZ_LEFT = 0x01
- HORZ_CENTER = 0x02
- HORZ_RIGHT = 0x03
- HORZ_FILLED = 0x04
- HORZ_JUSTIFIED = 0x05 # BIFF4-BIFF8X
- HORZ_CENTER_ACROSS_SEL = 0x06 # Centred across selection (BIFF4-BIFF8X)
- HORZ_DISTRIBUTED = 0x07 # Distributed (BIFF8X)
垂直对齐
- VERT_TOP = 0x00
- VERT_CENTER = 0x01
- VERT_BOTTOM = 0x02 -VERT_JUSTIFIED = 0x03 # Justified (BIFF5-BIFF8X)
- VERT_DISTRIBUTED = 0x04 # Distributed (BIFF8X)
import xlwt as xw
style=xw.XFStyle()
alignment=xw.Alignment()# xw.Alignment??
alignment.horz=xw.Alignment.HORZ_CENTER #设置水平局中对齐
alignment.horz=xw.Alignment.VERT_CENTER #这是垂直居中对齐
alignment.horz=0x02#设置水平局中对齐
aligenment.horz=0x01#设置垂直居中对齐
style.alignment=aligenment
标签:
python
本文转载自: https://blog.csdn.net/qq_45415372/article/details/115469980
版权归原作者 qq_45415372 所有, 如有侵权,请联系我们删除。
版权归原作者 qq_45415372 所有, 如有侵权,请联系我们删除。