prs = Presentation('temp.pptx')
xl=xlrd.open_workbook('11月分报告数据.xlsx')
#幻灯片3
slide=prs.slides[2]
j=0
for shape in slide.shapes:
if not shape.has_chart:
continue
else:
if j==0:
chart = shape.chart
a=chart.series[0].values
b=chart.series[1].values
print(a,b)
j += 1
chart_data1 = ChartData()
table = xl.sheet_by_name("P3")
cat=[]
s1 = [] #10月
s2 = [] #11月
for i in range(2,10):
cat.append(table.cell(31,i).value)
s1.append(table.cell(16, i).value)
s2.append(table.cell(32, i).value)
print(cat)
print(s1)
print(s2)
# chart_data.categories = ['集团', ppt_name]
# chart_data.add_series('项目总得分', (table.cell(13, 2).value, table.cell(contr_row + 1, contr_col + 2).value))
# chart.replace_data(chart_data)
else:
chart = shape.chart
a = chart.series[0].values
print(cat)