首页 > 编程语言 > 详细

Python --pptx--同一序列多数据

时间:2017-12-24 21:59:08      阅读:679      评论:0      收藏:0      [点我收藏+]
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‘)

Python --pptx--同一序列多数据

原文:http://www.cnblogs.com/xiesongyou/p/8099227.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!