[xlwt] Changing Cell Background Color

C

Chanman

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,252
Messages
2,571,267
Members
47,905
Latest member
Yoshi13

Latest Threads

Top