prs = Presentation(‘2017年北科建第一阶段满意度调研报告V.7.0汇报.pptx‘)
slide=prs.slides[8]
for shape in slide.shapes:
if not shape.has_chart:
continue
else:
chart = shape.chart
chart_data = ChartData()
chart_data.categories = [‘东部‘, ‘西部‘]
chart_data.add_series(‘北京‘, (19.2, 21.4))
chart_data.add_series(‘上海‘, (22.3, 28.6))
chart_data.add_series(‘天津‘, (20.4, 26.3))
chart.replace_data(chart_data)
prs.save(‘test.pptx‘)