使用openpyx在现有文件中给一些文本行着色

2024-03-29 11:30:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我想知道是否可以使用openpyxl仅为一些文本/字符行着色,并将它们输出到同一张excel工作表上

例如:

The dog is red. The man is blue. My favorite color is black.

致:

The dog is [blue] red [/blue]. The man is [blue] blue [/blue] . My favorite color is [blue] yellow [/blue].

我有需要使用颜色的字符串和字符串的位置,即使是相同的颜色(蓝色或绿色),也可以

谢谢

注:[blue] [/blue]表示括号内的颜色为蓝色


Tags: the字符串文本is颜色mybluered