Python xlwt模块操作Excel设置格式相关方法
#设置高度和行宽
sheet1.row(0).height_mismatch = True
sheet1.row(0).height = 800
sheet1.col(0).width = True
sheet1.col(0).width = 30000
#设置字体和大小
font_RedBlob = xlwt.Font()
font_RedBlob.name = 'SimSun'
font_RedBlob.height = 20 * 12
font_RedBlob.bold = True
font_RedBlob.colour_index = 10
#设置背景色
pattern = xlwt.Pattern()
pattern.pattern = xlwt.Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 22
#设置单元格实虚线
#1 细实线 2 粗实线
borders_1 = xlwt.Borders()
borders_1.left = 1
borders_1.right = 1
borders_1.top = 1
borders_1.bottom = 1
#设置居中
dq = xlwt.Alignment()
dq.horz = 0x02 # 设置水平居中
dq.vert = 0x01
努力让自己变得不那么low