使用xlwt/openpyxl将多种格式应用于单元格的能力 [英] The ability to apply multiple formats to cell with xlwt / openpyxl
问题描述
我计划使用以下2个库之一在python中输出excel文件:
I plan to use one of 2 libraries below to output excel file in python:
- xlwt( http://www.python-excel.org/)
- openpyxl( http://packages.python.org/openpyxl/)
- xlwt ( http://www.python-excel.org/ )
- openpyxl ( http://packages.python.org/openpyxl/ )
我尝试了第一个,大多数情况似乎都很好,但是有一个问题,不幸的是,它可能不支持将多种格式应用于单元格的功能. (请参见 http://groups.google.com/group/python- excel/browse_thread/thread/11c24606d9b2914d )
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)
是真的吗?
如果是,有人知道如何解决吗?
If yes, does anybody know how to solve it?
例如,它不能使某些单词加粗,另一些常规字体或其他字体.
E.g it cannot make some words bold, others regular or different font.
下面的照片是我想做的事的例子.您会看到以粗体显示的Peter和以常规文字显示的Fernando.
The photo below is the example of what I wanna do. You can see Peter in bold and Fernando in regular text style.
推荐答案
xlrd
和xlwt
的svn版本都支持富文本",这是您想要的MS行话.
The svn versions of both xlrd
and xlwt
have support for "rich text", which is MS jargon for what you want.
这篇关于使用xlwt/openpyxl将多种格式应用于单元格的能力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!