3
votes

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
This post seems to indicate that there are a number of bugs with "styles" in openpyxl. Posting your relevant code here will help you get an answer as well - if there's one to be had outside of reporting this as a bug. - wahwahwah
@wahwahwah there are no bugs in the styles in openpxyxl. - Charlie Clark

1 Answers

0
votes

openpyxl does not support multiple styles within an individual cell.