1. 程式人生 > >pptx-txt

pptx-txt

sar continue new ali 優勢 res add class ces

prs = Presentation(‘2017年北科建第一階段滿意度調研報告V.7.0匯報.pptx‘)


slide=prs.slides[2]
j=1
for shape in slide.shapes:
if not shape.has_text_frame:
continue
text_frame = shape.text_frame
print(str(j)+‘=>‘+text_frame.text)
j+=1
if j==8:
text_frame = shape.text_frame
text_frame.clear() # not necessary for newly-created shape

p = text_frame.paragraphs[0]
run = p.add_run()
run.text = ‘我的數據‘

font = run.font
font.name = ‘Calibri‘
font.size = Pt(36)
font.bold = True
font.italic = None # cause value to be inherited from theme
font.color.rgb = RGBColor(0, 0, 0)
p1 = text_frame.add_paragraph()
text_frame.word_wrap=True
run1 = p.add_run()
run1.text = ‘\n保持北科建服務優勢\n找出北科建關鍵短板\n提升北科建競爭優勢‘
font = run1.font
font.name = ‘Calibri‘
font.size = Pt(24)
font.bold = True
font.italic = None # cause value to be inherited from theme
font.color.rgb = RGBColor(0, 0, 0)
prs.save(‘test.pptx‘)

pptx-txt