scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.44k stars 527 forks source link

how to read font color! #938

Open qihangsheji opened 9 months ago

qihangsheji commented 9 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 9 months ago

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

vanillar7 commented 1 month ago

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

there has an error. AttributeError: no .rgb property on color type '_NoneColor'