6

I plan to use one of 2 libraries below to output excel file in python:

  1. xlwt ( http://www.python-excel.org/ )
  2. openpyxl ( http://packages.python.org/openpyxl/ )

I tried the first one, most of things seem to be fine but one issue, unfortunately it may not support the ability to apply multiple formats to cell. (see http://groups.google.com/group/python-excel/browse_thread/thread/11c24606d9b2914d)

Is it true?

If yes, does anybody know how to solve it?

E.g it cannot make some words bold, others regular or different font.

The photo below is the example of what I wanna do. You can see Peter in bold and Fernando in regular text style.

Example

Quan
  • 473
  • 7
  • 16
  • All you asked about was `xlwt`. What is your question about `openpyxl`? – Mike Pennington Dec 09 '11 at 09:56
  • I didn't try openpyxl but I haven't found any articles talking about this problem - multiple formats in one cell. – Quan Dec 12 '11 at 07:22
  • Seems like much time has passed since this question was answered. I wonder whether current version of openpyxl supports "rich text" in cells. – precise May 07 '18 at 12:49

2 Answers2

6

The svn versions of both xlrd and xlwt have support for "rich text", which is MS jargon for what you want.

John Machin
  • 81,303
  • 11
  • 141
  • 189
  • Update: You can get released versions of xlrd and xlwt from PyPI now ... http://pypi.python.org/pypi/packagename – John Machin Mar 18 '12 at 11:13
0

I have another answer which explains how to apply many formatting styles using openpyxl...

Setting styles in Openpyxl

Community
  • 1
  • 1
Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
  • Dear Mike, thanks for your answer but that's not what I need. I edited my question, added an example picture. – Quan Dec 13 '11 at 08:23