Put style and background color python excel
I want to make excel value to center align and have yellow background color. But I cannot enter too many arguments. So I try to do this, but nothing happens. Is there any other way to do this?
colorCenter = xlwt.XFStyle()
xlwt.add_palette_colour("custom_colour", 0x21)
wb.set_colour_RGB(0x21, 255, 255, 0)
color = xlwt.easyxf('pattern: pattern solid, fore_colour custom_colour')
colorCenter.color = color
alignment = xlwt.Alignment()
alignment.horz = xlwt.Alignment.HORZ_CENTER
center = xlwt.XFStyle()
colorCenter.center = center
sheet.write(11, 3, 'value', colorCenter)
+3
source to share