问题
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