Message from discussion
Background with any rgb value
Received: by 10.114.108.8 with SMTP id g8mr4290150wac.9.1227862150718;
Fri, 28 Nov 2008 00:49:10 -0800 (PST)
Return-Path: <sjmac...@lexicon.net>
Received: from poplet1.per.eftel.com (poplet1.per.eftel.com [203.24.100.46])
by mx.google.com with ESMTP id k32si1412914wah.1.2008.11.28.00.49.09;
Fri, 28 Nov 2008 00:49:10 -0800 (PST)
Received-SPF: neutral (google.com: 203.24.100.46 is neither permitted nor denied by best guess record for domain of sjmac...@lexicon.net) client-ip=203.24.100.46;
Authentication-Results: mx.google.com; spf=neutral (google.com: 203.24.100.46 is neither permitted nor denied by best guess record for domain of sjmac...@lexicon.net) smtp.mail=sjmac...@lexicon.net
Received: from [192.168.1.2] (202.76.163.18.dynamic.rev.eftel.com [202.76.163.18])
by poplet1.per.eftel.com (Postfix) with ESMTP id 02287442E9
for <python-excel@googlegroups.com>; Fri, 28 Nov 2008 17:49:07 +0900 (WST)
Message-ID: <492FB07E.6080104@lexicon.net>
Date: Fri, 28 Nov 2008 19:49:02 +1100
From: John Machin <sjmac...@lexicon.net>
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
To: python-excel@googlegroups.com
Subject: Re: [pyxl] Background with any rgb value
References: <c7a00cf2-fb65-40a3-9c2d-50b95a0c2bb7@r40g2000yqj.googlegroups.com>
In-Reply-To: <c7a00cf2-fb65-40a3-9c2d-50b95a0c2bb7@r40g2000yqj.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 28/11/2008 15:59, Grigoriy Petukhov wrote:
> Hi.
> I want to fill the background of cell with some RGV value. Is it
> possible?
> I found only how to fill background with color from predefined set of
> colors (xlwt.Style.colour_map_text).
Excel 97-2003 doesn't support setting cell background to an arbitrary
RGB value in a generalised fashion. What it does support is the ability
to change the RGB values associated with one or more colour indexes in
the palette. This is not implemented in xlwt (yet).
Here is an OTTOMH sketch of what needs to be done to implement this
facility, in case someone wants to jump in and help:
1. Set up const default palette (grab it from e.g. xlrd.formatting.py).
2. Initialise working palette from default.
3. Provide API Workbook.set_palette_entry(colour_index, red, green,
blue) ... validations: colour_index in range(8, 64); r/g/b in range(256).
4. When saving workbook: if working palette is not the same as the
default palette, write a PALETTE record [there is a stub for this].
Cheers,
John