scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.26k stars 498 forks source link

how to read font color! #938

Open qihangsheji opened 5 months ago

qihangsheji commented 5 months ago

Most of the time, it's not available. font.color.type is None , But in fact there are colors ` for paragraph in shape.text_frame.paragraphs: print("paragraph") print(paragraph.font.color.type) for run in paragraph.runs:

提取文本内容、字体、大小和颜色

                        print("run")
                        print(run.font.color.type)
                        font_name = run.font.name
                        #font_size = run.font.size.pt  # 字体大小(以磅为单位)
                        font_color = run.font.color`
ME-researchgroup commented 5 months ago

have you tried reading the rgb value from run.font.color.rgb?