The ability to apply multiple formats to cell with xlwt / openpyxl

廉价感情. 提交于 2019-11-28 00:51:39

问题


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.


回答1:


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




回答2:


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

Setting styles in Openpyxl



来源:https://stackoverflow.com/questions/8429014/the-ability-to-apply-multiple-formats-to-cell-with-xlwt-openpyxl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!