中所有的元素均被当成一个shape,slide.shapes表示幻灯片类中的模型类,placeholders中为每个模型,采用slide_layouts[1]中包含两个文本框,所以printlen(slide.shapes.placeholders...textbox= slide.shapes.add_textbox(left, top, width, height)
# left,top为相对位置,width,height为文本框大小
textbox.text...= 'this is a new textbox'
# 文本框中文字
new_para= textbox.text_frame.add_paragraph()
# 在新文本框中添加段落
new_para.text...height= Inches(1), Inches(4.5), Inches(2), Inches(2)
# 预设位置及大小
pic= slide.shapes.add_picture(img_path..., left, top, width, height)
# 在指定位置按预设值添加类型为PENTAGON的形状
shape.text= 'Step 1'
forninrange(2, 6):