颜色整行细胞文本

时间:2013-10-16 07:56:22

标签: python xlwt

我正在使用单个单元格为文本着色

worksheet.write(1, 1, "This is a row 1, column 1", xlwt.easyxf("font: color blue;"))
worksheet.write(1, 2, "This is a row 1, column 2", xlwt.easyxf("font: color blue;"))
worksheet.write(1, 3, "This is a row 1, column 3", xlwt.easyxf("font: color blue;"))

可以这样做,以便单个操作可以改变行文本的整个颜色。

2 个答案:

答案 0 :(得分:0)

如果您的意思是想要循环更改语句:

for index in xrange(1, 4):
    worksheet.write(1, index, "This is a row 1, column %d" % index,
     xlwt.easyxf("font: color blue;"))

答案 1 :(得分:0)

for col in range(1,4):
    worksheet.write(1, col, "This is a row 1, column "+str(col), xlwt.easyxf("font: color blue;"))