[xlwt] Changing Cell Background Color

Discussion in 'Python' started by Chanman, Jun 19, 2008.

  1. Chanman

    Chanman Guest

    I've posted this on the python-excel group, but perhaps people here
    know what to do.

    How does one change the cell background color using the xlwt module?
    I've looked at several tutorials but none show how to change the
    background color. I've tried the following:

    badBG = xlwt.Pattern()
    badBG.SOLID_PATTERN = 0x34
    badBG.NO_PATTERN = 0x34
    badBG.pattern_fore_colour = 0x34
    badBG.pattern_back_colour = 0x34

    badFontStyle = xlwt.XFStyle()
    badFontStyle.Pattern = badBG

    sheet1.write(1,1,'hello world', badFontStyle)

    However, the background cell color still remains white. Any help
    appreciated.
    Chanman, Jun 19, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hal Vaughan
    Replies:
    5
    Views:
    29,764
  2. RJ
    Replies:
    1
    Views:
    228
    Eliyahu Goldin
    Feb 17, 2005
  3. Kamaljeet Saini
    Replies:
    0
    Views:
    379
    Kamaljeet Saini
    Feb 13, 2009
  4. Arthur Shapiro
    Replies:
    29
    Views:
    312
    Arthur Shapiro
    Jan 2, 2005
  5. Replies:
    1
    Views:
    138
    Martin Honnen
    Mar 27, 2005
Loading...

Share This Page