Currently this is my code:
from pptx import Presentation
from pptx.util import Pt
f = open(r'template.pptx', 'rb')
prs = Presentation(f)
f.close()
slide = prs.slides.add_slide(prs.slide_masters[0].slide_layouts[1])
title = slide.placeholders[10]
title.text = "REPORT"
prs.save('test.pptx')
How do I format the 'REPORT' title text, to be yellow and bold?
Access the font properties using title.font
:
from pptx.dml.color import RGBColor # add this import to the top of the file
title.font.bold = True
title.font.color.rgb = RGBColor(0xFF, 0xFF, 0x00)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.