Closed yetong2023 closed 8 months ago
On Stack Overflow I asked you to clarify what "doesn't work" means.
It seems just change the name of font. But didn't set it to "Calibri" really.
font.name='Calibri' print(font.name) out: Calibri
However, when I open PPT file and check, the font didn't change to Calibri. It remains "Times New Roman". So, "font.name=Calibri" didn't work, it didn't change the font type to Calibri.
@yetong2023, you are close, try setting the font attributes to the current run for each iteration:
for run in para.runs:
run.font.size = pptx.util.Pt(20)
run.font.color.rgb = pptx.dml.color.RGBColor(140,0,0)
run.font.name = 'Calibri'
pptx 字体修改不支持utf-8的字符。
I want to set all font to "Calibri", I use the following code to change font size,color sucessfully. font.name doesn't work however. I build a another ppt and try again, failed again. And one question, where can I get font name list?