[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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top