"util"? Do you mean "tutorial"?
> style0 = xlwt.easyxf(
> 'font: name Times New Roman, colour_index red'
> )
>
> there is color red instead of color_index too .
color, colour, color_index, and colour_index are synonyms
> Is there any provision to color the entire row?
For "color the entire row", you may want the "pattern" colour (background)
rather than the font colour (the colour used for the displayed text). In
any case, you need to set up a style with what you want, use that for
every write that you do in the target row, AND set the row default to that
style as well (so that empty cells also get the treatment). The folloing
example illustrates this:
import xlwt
special_style = xlwt.easyxf(
"pattern: fore_colour red, pattern solid;"
"font: colour yellow;"
)
default_style = xlwt.easyxf("")
wb = xlwt.Workbook()
ws = wb.add_sheet("x")
for rowx, style in enumerate((special_style, special_style, default_style,
default_style)):
ws.write(rowx, 0, "A", style)
ws.write(rowx, 1, None, style) # column B is "blank" (formatting but
no data)
ws.write(rowx, 2, "C", style)
# column D is empty (no data, no formatting)
ws.write(rowx, 4, "E", style)
if rowx % 2:
ws.row(rowx).set_style(special_style)
wb.save('row_colour.xls')