[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. Advertisements

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. Thanks
    Replies:
    1
    Views:
    739
    Thanks
    Feb 8, 2004
  2. Vam

    cell background color

    Vam, Feb 15, 2005, in forum: HTML
    Replies:
    9
    Views:
    3,698
    Sid Ismail
    Feb 16, 2005
  3. Barbara de Zoete

    Re: cell background color

    Barbara de Zoete, Feb 15, 2005, in forum: HTML
    Replies:
    5
    Views:
    621
    Barbara de Zoete
    Feb 15, 2005
  4. Hal Vaughan
    Replies:
    5
    Views:
    31,234
  5. RJ
    Replies:
    1
    Views:
    403
    Eliyahu Goldin
    Feb 17, 2005
  6. Kamaljeet Saini
    Replies:
    0
    Views:
    846
    Kamaljeet Saini
    Feb 13, 2009
  7. Arthur Shapiro
    Replies:
    29
    Views:
    512
    Arthur Shapiro
    Jan 2, 2005
  8. Replies:
    1
    Views:
    229
    Martin Honnen
    Mar 27, 2005
Loading...