Multiple styles in one cell in openpyxl

十年热恋 提交于 2019-12-22 09:33:49

问题


I wrote a Python program which produces invoices in a specific form as .xlsx files using openpyxl. I have the general invoice form as an Excel workbook and my program copies this form and fills up the details about the specific client (eg. client refernce number, price, etc.) which are read from another .txt file.

The program works perfectly. The only problem is that the form contains a cell which has multiple styles: half of the letters are red and the rest black and there is also size difference. This cell is not edited in my program (it is the same in all the invoices), however after the rest worksheet is edited by my program the cell keeps only the first style (the red letters).

Why does openpyxl changes this cell since I don't edit it? Does openpyxl support multiple styles, or I have to split the letters with different styles in seperate cells?


回答1:


openpyxl does not support multiple styles within an individual cell.



来源:https://stackoverflow.com/questions/32788716/multiple-styles-in-one-cell-in-openpyxl

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