from pptx import Presentation
from pptx.util import Inches
from pptx.enum.text import MSO_AUTO_SIZE
from pptx.enum.chart import XL_TICK_MARK
from pptx.util import Pt
from pptx.chart.data import ChartData
from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE,MSO_CONNECTOR_TYPE
from pptx.dml.color import RGBColor
from pptx.enum.chart import XL_DATA_LABEL_POSITION
from pptx.enum.chart import XL_LEGEND_POSITION
from pptx.enum.chart import XL_CHART_TYPE
from pptx.enum.chart import XL_MARKER_STYLE
from pptx.enum.chart import XL_TICK_LABEL_POSITION
prs = Presentation('2017年北科建第一阶段满意度调研报告V.7.0汇报.pptx')
slide=prs.slides[10]
for shape in slide.shapes:
if not shape.has_chart:
continue
else:
chart = shape.chart
chart_data = ChartData()
chart_data.categories = ['集团1',' ','集团2','集团3','集团4','集团5',]
chart_data.add_series('行业对比',(19,'',20,22,25,30))
chart_data.add_series('行业对比',(29,'',35,26,37,20))
chart_data.add_series('行业对比',(30,'',18,40,15,41))
chart.replace_data(chart_data)
prs.save('test.pptx')