python-北科

from pptx import Presentation
from pptx.util import Inches
from pptx.chart.data import ChartData
from pptx.enum.chart import XL_TICK_MARK
from pptx.util import Pt
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

def insert_pic(slide,img_path,left,top,width,height):
slide.shapes.add_picture(img_path, left, top, width, height)
def insert_txt(slide,text,left,top,width,height,size,r=0,g=0,b=0,B=True,name='微软雅黑'):
txt_box = slide.shapes.add_textbox(left, top, width, height)
tf = txt_box.text_frame.add_paragraph()
tf.font.name=name
tf.font.size = Pt(size)
tf.font.bold = B
tf.font.color.rgb = RGBColor(r, g, b)
tf.text = text
return tf


#第1张幻灯片
prs=Presentation("123.pptx")
slide = prs.slides.add_slide(prs.slide_layouts[6])
#背景
img_path="./bg/bg-01.png"
left,top,width,height=Inches(0),Inches(0),Inches(13.34),Inches(7.5)
insert_pic(slide,img_path,left,top,width,height)

#大标题
left,top,width,height=Inches(0.75),Inches(1.57),Inches(6.5),Inches(1.5)
txBox1_1=slide.shapes.add_textbox(left,top,width,height)
tf01 = txBox1_1.text_frame.add_paragraph()
tf01.text = "2017年北科建住宅地产\n满意度调研报告"
tf01.font.size=Pt(44)
# tf.font.name=u"隶书"
tf01.font.bold=True
tf01.font.color.rgb=RGBColor(255,255,255)

#小标题
left,top,width,height=Inches(2.1),Inches(3.6),Inches(3.4),Inches(0.7)
txBox1_2=slide.shapes.add_textbox(left,top,width,height)
tf02 = txBox1_2.text_frame.add_paragraph()
tf02.font.size=Pt(36)
tf02.font.bold=True
tf02.font.color.rgb=RGBColor(255,255,255)
tf02.text = "(第一阶段)"

#矩形框公司标记
left,top,width,height=Inches(0.75),Inches(5.5),Inches(6.5),Inches(0.8)
shape = slide.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x3F, 0x2c, 0x36)
fill.fore_color.brightness = 0.25
shape.text = '北京思特威信息咨询有限公司\nBeijing Stat survey Marketing Services Co. LTD'


#第2张幻灯片
#背景
slide2 = prs.slides.add_slide(prs.slide_layouts[6])

img_path="./bg/bg-02.png"
left,top,width,height=Inches(0),Inches(0),Inches(13.34),Inches(7.5)
insert_pic(slide2,img_path,left,top,width,height)

#目录
left,top,width,height=Inches(7),Inches(1),Inches(5),Inches(1.2)
insert_txt(slide2,"目 录",left,top,width,height,44,r=255,g=255,b=255)

left,top,width,height=Inches(7),Inches(2.1),Inches(6.34),Inches(0.4)
shape = slide2.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
#fill.patterned()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x3F, 0x2c, 0x36)
# fill.back_color.rgb = RGBColor(0x3F, 0x2c, 0x36)
fill.fore_color.brightness = 0.25

left,top,width,height=Inches(7),Inches(2.9),Inches(6.34),Inches(0.8)
insert_txt(slide2,"01. 项目概述",left,top,width,height,28,r=255,g=255,b=255)
top=Inches(4.1)
insert_txt(slide2,"02.满意度回访调研情况分析",left,top,width,height,28,r=197,g=197,b=197)
top=Inches(5.3)
insert_txt(slide2,"03. 总结与建议",left,top,width,height,28,r=197,g=197,b=197)

#第3张幻灯片
#背景
slide3 = prs.slides.add_slide(prs.slide_layouts[6])
img_path="./bg/bg-03.png"
left,top,width,height=Inches(0),Inches(0),Inches(13.34),Inches(7.5)
insert_pic(slide3,img_path,left,top,width,height)
#标题
left,top,width,height=Inches(0.5),Inches(0.02),Inches(5),Inches(1.2)
insert_txt(slide3,"调研目的与方法",left,top,width,height,36,r=70,g=70,b=112)

#图片1
img_path="./bg/bg-0301.png"
left,top,width,height=Inches(0.3),Inches(1.1),Inches(3),Inches(3)
insert_pic(slide3,img_path,left,top,width,height)
#图片2
img_path="./bg/bg-0302.png"
left,top,width,height=Inches(3.5),Inches(1.1),Inches(3),Inches(3)
insert_pic(slide3,img_path,left,top,width,height)
#图片3
img_path="./bg/bg-0303.png"
left,top,width,height=Inches(0.3),Inches(4.15),Inches(3),Inches(3)
insert_pic(slide3,img_path,left,top,width,height)
#矩形框1
left,top,width,height=Inches(6.7),Inches(1.1),Inches(3),Inches(3)
shape = slide3.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x96, 0xcd, 0xcd)
fill.fore_color.brightness = 0.75
#矩形框2
left,top,width,height=Inches(9.9),Inches(1.1),Inches(3),Inches(3)
shape = slide3.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)

fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x96, 0xcd, 0xcd)
fill.fore_color.brightness = 0.25
#矩形框3
left,top,width,height=Inches(3.5),Inches(4.2),Inches(9.4),Inches(2.9)
shape = slide3.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)

fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x96, 0xcd, 0xcd)
fill.fore_color.brightness = 0.8

#图片4-5
img_path="./bg/bg-0304.png"
left,top,width,height=Inches(6.8),Inches(1.2),Inches(0.53),Inches(0.63)
insert_pic(slide3,img_path,left,top,width,height)

left,top,width,height=Inches(10),Inches(1.2),Inches(0.53),Inches(0.63)
insert_pic(slide3,img_path,left,top,width,height)

#图片6
img_path="./bg/bg-0306.png"
left,top,width,height=Inches(3.6),Inches(4.3),Inches(0.6),Inches(0.6)
insert_pic(slide3,img_path,left,top,width,height)

#调研目的
left,top,width,height=Inches(7.2),Inches(1.2),Inches(2.6),Inches(0.8)
insert_txt(slide3,"调研目的",left,top,width,height,24)

left,top,width,height=Inches(7.2),Inches(1.8),Inches(2.6),Inches(2.2)
insert_txt(slide3,"保持北科建服务优势\n\n找出北科建关键短板\n\n提升北科建竞争优势",
left,top,width,height,18,0,0,0,False)


#调研目标
left,top,width,height=Inches(10.4),Inches(1.2),Inches(2.6),Inches(0.8)
insert_txt(slide3,"调研目标",left,top,width,height,24)

left,top,width,height=Inches(10.4),Inches(1.8),Inches(2.6),Inches(2.2)
insert_txt(slide3,"调研以客户为导向\n\n的销售策略,实现\n\n营销与服务协同",
left,top,width,height,18,0,0,0,False)

#调研方法
left,top,width,height=Inches(4.2),Inches(4.0),Inches(2.6),Inches(0.8)
insert_txt(slide3,"调研方法",left,top,width,height,24)

left,top,width,height=Inches(4.2),Inches(4.7),Inches(2.6),Inches(0.8)
insert_txt(slide3,"电话满意度回访",left,top,width,height,18,0,0,0,False)

#调研频次
left,top,width,height=Inches(4.2),Inches(5.2),Inches(2.6),Inches(0.8)
insert_txt(slide3,"调研频次",left,top,width,height,24)

left,top,width,height=Inches(4.2),Inches(5.9),Inches(2.6),Inches(0.8)
insert_txt(slide3,"电话满意度回访调研8个项目,每个项目抽样进行回访",left,top,width,height,18,0,0,0,False)

#第4张幻灯片
#背景
slide4 = prs.slides.add_slide(prs.slide_layouts[6])
img_path="./bg/bg-03.png"
left,top,width,height=Inches(0),Inches(0),Inches(13.34),Inches(7.5)
insert_pic(slide4,img_path,left,top,width,height)

#标题
left,top,width,height=Inches(0.5),Inches(0.02),Inches(5),Inches(1.2)
insert_txt(slide4,"满意度调研指标体系",left,top,width,height,36,r=70,g=70,b=112)

#小标题
left,top,width,height=Inches(0.3),Inches(0.8),Inches(13),Inches(1.6)
text0401='☆满意度调研指标评分采用1-5分进行评价,二级指标维度评分低于2分的业主询问不满意原因;\n☆内容涉及 能够全面了解北科建项目业主全流程评价。'
text0402='3个一级指标,8个二级指标,35*个细项,'
insert_txt(slide4,text0401,left,top,width,height,20,0,0,0,False)
left,top,width,height=Inches(1.75),Inches(1.13),Inches(13),Inches(0.8)
insert_txt(slide4,text0402,left,top,width,height,20,255,0,0)

#指标-横条4个
left,top,width,height=Inches(0.2),Inches(2.),Inches(1.4),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.10
left,top,width,height=Inches(0.25),Inches(1.67),Inches(1.4),Inches(0.3)
insert_txt(slide4,'I级指标',left,top,width,height,20,255,255,255)

left,top,width,height=Inches(1.7),Inches(1.85),Inches(0.05),Inches(0.7)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x33, 0x33)

# 二级指标
left,top,width,height=Inches(0.2),Inches(4.),Inches(1.4),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(0.25),Inches(3.67),Inches(1.3),Inches(0.3)
insert_txt(slide4,'II级指标',left,top,width,height,20,255,255,255)
left,top,width,height=Inches(1.7),Inches(3.7),Inches(0.05),Inches(1)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x69, 0x69, 0x69)

#三级指标
left,top,width,height=Inches(0.2),Inches(5.83),Inches(1.4),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.30
left,top,width,height=Inches(0.25),Inches(5.5),Inches(1.4),Inches(0.3)
insert_txt(slide4,'III级指标',left,top,width,height,20,255,255,255)

left,top,width,height=Inches(1.7),Inches(5.7),Inches(0.05),Inches(0.7)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x80, 0x80, 0x80)

#忠诚度
left,top,width,height=Inches(2),Inches(1.95),Inches(3.12),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.ROUND_2_DIAG_RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0xff, 0xa5, 0x00)
# fill.fore_color.brightness = 0.10
left,top,width,height=Inches(2.9),Inches(1.65),Inches(1.6),Inches(0.3)
insert_txt(slide4,'忠诚度',left,top,width,height,20,255,255,255)

#总体满意度
left,top,width,height=Inches(5.5),Inches(1.95),Inches(3.12),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.ROUND_2_DIAG_RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0xff, 0xa5, 0x00)
# fill.fore_color.brightness = 0.10
left,top,width,height=Inches(6.2),Inches(1.65),Inches(1.6),Inches(0.3)
insert_txt(slide4,'总体满意度',left,top,width,height,20,255,255,255)

#品牌评价
left,top,width,height=Inches(9),Inches(1.95),Inches(3.12),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.ROUND_2_DIAG_RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0xff, 0xa5, 0x00)
# fill.fore_color.brightness = 0.10
left,top,width,height=Inches(9.8),Inches(1.65),Inches(1.6),Inches(0.3)
insert_txt(slide4,'品牌评价',left,top,width,height,20,255,255,255)

#前期服务
left,top,width,height=Inches(2),Inches(2.75),Inches(2.5),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.ROUND_2_DIAG_RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0xff, 0xde, 0xad)
# fill.fore_color.brightness = 0.10
left,top,width,height=Inches(2.6),Inches(2.5),Inches(1.6),Inches(0.3)
insert_txt(slide4,'前期服务',left,top,width,height,20)

#产品端口
left,top,width,height=Inches(4.5),Inches(2.75),Inches(5.0),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.ROUND_2_DIAG_RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0xff, 0xde, 0xad)
# fill.fore_color.brightness = 0.10
left,top,width,height=Inches(6.3),Inches(2.5),Inches(1.6),Inches(0.3)
insert_txt(slide4,'产品端口',left,top,width,height,20)

#后续服务
left,top,width,height=Inches(9.45),Inches(2.75),Inches(2.62),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.ROUND_2_DIAG_RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0xff, 0xde, 0xad)
# fill.fore_color.brightness = 0.10
left,top,width,height=Inches(10.1),Inches(2.5),Inches(1.6),Inches(0.3)
insert_txt(slide4,'后续服务',left,top,width,height,20)
#划线
left,top,width,height=Inches(2.4),Inches(3.45),Inches(9.4),Inches(0.03)
shape = slide4.shapes.add_shape(MSO_CONNECTOR_TYPE.STRAIGHT, left, top, width, height)
for i in range(0,7):
left,top,width,height=Inches(2.4+i*1.568),Inches(3.45),Inches(0.03),Inches(0.5)
shape = slide4.shapes.add_shape(MSO_CONNECTOR_TYPE.STRAIGHT, left, top, width, height)

# 销售服务
left,top,width,height=Inches(2.),Inches(4.),Inches(1.3),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(2.),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'销售服务',left,top,width,height,18,255,255,255)

# 收楼交房
left,top,width,height=Inches(3.4),Inches(4.),Inches(1.3),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(3.4),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'收楼交房',left,top,width,height,18,255,255,255)

# 小区规划/设计
left,top,width,height=Inches(4.8),Inches(4.),Inches(1.65),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(4.7),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'小区规划/设计',left,top,width,height,18,255,255,255)


# 房屋质量
left,top,width,height=Inches(6.55),Inches(4.),Inches(1.3),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(6.6),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'房屋质量',left,top,width,height,18,255,255,255)

# 维修服务
left,top,width,height=Inches(8.05),Inches(4.),Inches(1.3),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(8.1),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'维修服务',left,top,width,height,18,255,255,255)

# 物业服务
left,top,width,height=Inches(9.55),Inches(4.),Inches(1.3),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(9.6),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'物业服务',left,top,width,height,18,255,255,255)


# 投诉处理
left,top,width,height=Inches(11),Inches(4.),Inches(1.3),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.20
left,top,width,height=Inches(11.05),Inches(3.7),Inches(1.2),Inches(0.3)
insert_txt(slide4,'投诉处理',left,top,width,height,18,255,255,255)

#划线
left,top,width,height=Inches(2.4),Inches(5.2),Inches(9.42),Inches(0.03)
shape = slide4.shapes.add_shape(MSO_CONNECTOR_TYPE.STRAIGHT, left, top, width, height)
for i in range(0,7):
left,top,width,height=Inches(2.4+i*1.568),Inches(4.6),Inches(0.03),Inches(0.6)
shape = slide4.shapes.add_shape(MSO_CONNECTOR_TYPE.STRAIGHT, left, top, width, height)

# III级评分指标由若干个得分点(业主接触点)构成。
left,top,width,height=Inches(2),Inches(5.83),Inches(9),Inches(0.4)
shape = slide4.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, left, top, width, height)
fill=shape.fill
fill.solid()
fore_color = fill.fore_color
fore_color.rgb = RGBColor(0x33, 0x66, 0x66)
fill.fore_color.brightness = 0.85
left,top,width,height=Inches(2.05),Inches(5.55),Inches(1.2),Inches(0.3)
insert_txt(slide4,'III级评分指标由若干个得分点(业主接触点)构成。',left,top,width,height,18)

#第5张幻灯片
slide5 = prs.slides.add_slide(prs.slide_layouts[6])
img_path="./bg/bg-03.png"
left,top,width,height=Inches(0),Inches(0),Inches(13.34),Inches(7.5)
insert_pic(slide5,img_path,left,top,width,height)
#标题
left,top,width,height=Inches(0.5),Inches(0.02),Inches(5),Inches(1.2)
insert_txt(slide5,"调研样本量",left,top,width,height,36,r=70,g=70,b=112)

#小标题
left,top,width,height=Inches(0.3),Inches(0.8),Inches(13),Inches(1.6)
text0501='█ 业主满意度调研8个项目,共计450样本;' \
'\n█ 满意度采用CATI(即电话访问)完成;' \
'\n█ 调查时间:2017年6月7日-2017年6月20日。'

insert_txt(slide5,text0501,left,top,width,height,18,0,0,0,False)



prs.save("北科调查报告.pptx")
posted @ 2017-12-20 08:26  沧海一粒水  阅读(309)  评论(0编辑  收藏  举报