Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openpyxl - style on characters

I am trying to port my code from pywin32 to openpyxl. But I can't find the way to change the color style on partial characters in the cell. In pywin32, I can use: Range(Cell).GetCharacters(Start, Length).Font.ColorIndex to do this. But it seems there is no such method like that in openpyxl?

like image 820
Red Shen Avatar asked Nov 28 '25 18:11

Red Shen


1 Answers

The simple answer is that a cell is the smallest item to which you can apply styles to. You can work around this restriction by embedding formatting within the text but this is even messier than it sounds.

like image 79
Charlie Clark Avatar answered Dec 01 '25 06:12

Charlie Clark