GENERATE COLORS :

Lets play with colors, generates colors with the range specified in forloop


  1. import xlwt
  2. from decimal import *
  3. workbook = xlwt.Workbook()
  4. worksheet = workbook.add_sheet('colors')
  5. xlfile = xlwt.Pattern()
  6. xlfile.pattern = xlfile.SOLID_PATTERN
  7. for i in range(01000):
  8.     xlfile = xlwt.Pattern()
  9.     xlfile.pattern = xlfile.SOLID_PATTERN
  10.     xlfile.pattern_fore_colour = i
  11.     badFontStyle = xlwt.XFStyle()
  12.     badFontStyle.pattern = xlfile
  13.     worksheet.write(i,1,"", badFontStyle)
  14.     worksheet.write(i,2,str(i))
  15.     workbook.save("color.xls")