[pyxl] Does xlwt have the ability to apply multiple formats to a cell?

564 views
Skip to the first unread message

caesarmv

unread,
13 May 2010, 08:25:3013/05/2010
to python-excel
Does xlwt have the ability to apply multiple formats to a cell?


I need to color some words in cell. Is this posible?


I tried this code, but no easyfont found in current xlwt version....

http://groups.google.com/group/python-excel/browse_thread/thread/c12ff00747c977cf/f9fca58f0a50b15e?lnk=gst&q=xlwt+easyfont#f9fca58f0a50b15e

--
You received this message because you are subscribed to the Google Groups "python-excel" group.
To post to this group, send an email to python...@googlegroups.com.
To unsubscribe from this group, send email to python-excel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-excel?hl=en-GB.

John Machin

unread,
14 May 2010, 20:25:5414/05/2010
to python...@googlegroups.com
On 13/05/2010 10:25 PM, caesarmv wrote:
> Does xlwt have the ability to apply multiple formats to a cell?

No, and neither does Excel. What is possible is to have different fonts.
This applies only to to text cells and only to cells that are
constant. "Constant" in this instance means "not the result of a formula".

> I need to color some words in cell. Is this posible?

You can, in Excel, use fonts with different colours. You will be able to
have differently-coloured letters. The background will be fixed.
It has not been implemented. The patch perturbs the SST (shared string
table) which is one of the more crucial and most vaguely documented data
structures. It needs comprehensive focussed testing. None such was
supplied with the original patch. Some time later, another person agreed
after discussion of what was required, to write test scripts, went on
vacation, and has been uncontactable ever since.

Chris Withers

unread,
14 May 2010, 13:59:5914/05/2010
to python...@googlegroups.com
caesarmv wrote:
> Does xlwt have the ability to apply multiple formats to a cell?

This isn't what you meant to ask, but it's a nice question to answer, so
I will:

It would be great to apply multiple styles to a cell and have the end
result "logically OR'ed" to give the final style.
Sadly, this has not been implemented yet. Patches gratefully recieved!

> I need to color some words in cell. Is this posible?

This is the question you meant to ask. Sadly, the answer is "not
currenty". The type of formatting you require is not currently
implemented in xlwt.
To quote John:
...the code you would need IF IT DID SUPPORT IT might look
something like this:

Capitalisation added to help the hard of reading ;-)

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

John Yeung

unread,
27 Feb 2013, 14:12:3327/02/2013
to python...@googlegroups.com
On Mon, Feb 25, 2013 at 11:03 AM, Lou King <lous...@gmail.com> wrote:
> I was looking for the same topic (I need to color some words in a cell) and
> found this post.
>
> Just curious: it's been a couple of years -- has this limitation of xlwt
> changed in a later release?

Yes.

> If so, could you give me some pointers on how to do it?

http://stackoverflow.com/questions/14149748/format-individual-characters-in-a-single-excel-cell-with-python

John Y.

Lou King

unread,
27 Feb 2013, 16:27:2627/02/2013
to python...@googlegroups.com
thanks!  I'll look into that



--
You received this message because you are subscribed to a topic in the Google Groups "python-excel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-excel/EcJGBtmykU0/unsubscribe?hl=en-GB.
To unsubscribe from this group and all of its topics, send an email to python-excel...@googlegroups.com.

To post to this group, send an email to python...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages