pythonpptx 楷体_python-pptx 实践 4:添加形状、文本
1、添加流程箭头
#加载库
importosfrom pptx importPresentationfrom pptx.util importInches, Ptfrom pptx.enum.text importPP_ALIGNfrom pptx.enum.shapes importMSO_SHAPEfrom pptx.dml.color importRGBColor#设置路径
work_path = r'E:\pyspace\tmp\pptx'os.chdir(work_path)#实例化 ppt 文档对象
prs =Presentation()#插入幻灯片
title_only_slide = prs.slide_layouts[5]
slide_1=prs.slides.add_slide(title_only_slide)
shapes=slide_1.shapes
shapes.title.text= '煮鸡蛋的步骤'left= Inches(0.7)
top= Inches(2)
width= Inches(2)
height= Inches(1)for n in range(1, 6):#添加箭头形状
shape = shapes.add_shape(autoshape_type_id=MSO_SHAPE.CHEVRON, #v 形箭头
left=left,
top=top,
width=width,
height=height)
shape.text= 'Step %d' % n #文本颜色默认为白色,位于形状中心
#添加文本框
textbox = shapes.add_textbox(left=left,
top=top+height+Inches(0.3),
width=width,
height=Inches(4)
)
tf=textbox.text_frame
para=tf.add_paragraph()
para.text= 'do\n\n\n something'para.alignment= PP_ALIGN.CENTER #居中
#设置字体属性
font =para.font
font.size= Pt(24) #大小
font.name = 'Arial' #字体
font.bold = True #加粗
font.italic = True #倾斜
font.color.rgb = RGBColor(225, 225, 0) #黄色
#更新位置参数
left = left + width - Inches(0.3)#保存 ppt
prs.save('test.pptx')
效果:
35 种不同 autoshape_type_id 参数对应的形状
1、autoshape_type_id= MSO_SHAPE.ARC
2、 autoshape_type_id= MSO_SHAPE.BALLOON
3、autoshape_type_id= MSO_SHAPE.BEVEL
4、autoshape_type_id= MSO_SHAPE.CAN
5、autoshape_type_id= MSO_SHAPE.CHEVRON
6、autoshape_type_id= MSO_SHAPE.CHORD
7、autoshape_type_id= MSO_SHAPE.CLOUD
8、autoshape_type_id= MSO_SHAPE.CLOUD_CALLOUT
9、autoshape_type_id= MSO_SHAPE.CUBE
10、 autoshape_type_id= MSO_SHAPE.CURVED_DOWN_RIBBON
11、autoshape_type_id= MSO_SHAPE.CURVED_UP_RIBBON
12、autoshape_type_id= MSO_SHAPE.DECAGON
13、autoshape_type_id= MSO_SHAPE.DIAMOND
14、autoshape_type_id= MSO_SHAPE.DOUBLE_WAVE
15、autoshape_type_id= MSO_SHAPE.DOWN_ARROW
16、autoshape_type_id= MSO_SHAPE.EXPLOSION1
17、autoshape_type_id= MSO_SHAPE.FLOWCHART_CONNECTOR
18、autoshape_type_id= MSO_SHAPE.FLOWCHART_DECISION
19、autoshape_type_id= MSO_SHAPE.FLOWCHART_DIRECT_ACCESS_STORAGE
20、autoshape_type_id= MSO_SHAPE.FLOWCHART_DOCUMENT
21、 autoshape_type_id= MSO_SHAPE.FLOWCHART_MAGNETIC_DISK
22、autoshape_type_id= MSO_SHAPE.FLOWCHART_MULTIDOCUMENT
23、autoshape_type_id= MSO_SHAPE.FLOWCHART_PUNCHED_TAPE
24、autoshape_type_id= MSO_SHAPE.FLOWCHART_STORED_DATA
25、autoshape_type_id= MSO_SHAPE.FUNNEL
26、autoshape_type_id= MSO_SHAPE.HEART
27、autoshape_type_id= MSO_SHAPE.MOON
28、autoshape_type_id= MSO_SHAPE.OVAL
29、autoshape_type_id= MSO_SHAPE.OVAL_CALLOUT
30、autoshape_type_id= MSO_SHAPE.SMILEY_FACE
31、autoshape_type_id= MSO_SHAPE.STAR_5_POINT
32、autoshape_type_id= MSO_SHAPE.STAR_6_POINT
33、autoshape_type_id= MSO_SHAPE.SUN
34、 autoshape_type_id= MSO_SHAPE.TEAR
35、autoshape_type_id= MSO_SHAPE.WAVE
pythonpptx 楷体_python-pptx 实践 4:添加形状、文本相关推荐
- linux 适配电脑内核,Linux内核实践 如何添加网络协议[三]:实现 -电脑资料
内核版本:2.6.34 接上篇<添加网络协议>, 为了用户方便查看brcm设备的工作状态,使用proc文件系统是很好的方 式.一个网络协议模块可以注册到网络空间中register_pern ...
- 任意形状文本检测:Look More Than Once
点击我爱计算机视觉标星,更快获取CVML新技术 本文简要介绍2019年6月被CVPR2019录用论文"Look More Than Once: An Accurate Detector fo ...
- ICDAR 2019比赛及数据集下载-任务-ICDAR2019任意形状文本的鲁棒阅读挑战
ICDAR 2019比赛及数据集下载 https://rrc.cvc.uab.es/?ch=14&com=tasks 任务-ICDAR2019任意形状文本的鲁棒阅读挑战 我们提议的比赛包括三个 ...
- 如何在Microsoft Word中向对象添加替代文本
Alternative text (alt text) allows screen readers to capture the description of an object and read i ...
- R语言ggplot2在可视化图像中添加横线并在横线中添加文本、为横线中添加的文本添加文本框、自定义文本框的填充色(background color for a text annotation)
R语言ggplot2在可视化图像中添加横线并在横线中添加文本.为横线中添加的文本添加文本框.自定义文本框的填充色(background color for a text annotation) 目录
- 《正则表达式经典实例(第2版)》——2.19 在替代文本中添加字面文本
本节书摘来自异步社区<正则表达式经典实例(第2版)>一书中的第2章,第2.19节,作者: [美]Jan Goyvaerts , Steven Levithan著,更多章节内容可以访问云栖社 ...
- php 随机在文章中添加锚文本_SEO站长布局锚文本时的7大注意事项
通过对什么是锚文本链接.锚文本作用的讲解,以及怎样布局网站站内锚文本的介绍.相信大家都有了比较清晰的认识,也会重视网站锚文本的建设.但是菜鸟菌还是不得不再啰嗦点,锚文本虽然好处大大的,在布局锚文本的时 ...
- php 随机在文章中添加锚文本_锚文本对网站SEO优化有什么帮助?
对于优化人员来说,网站在做优化时都会在网站关键词或长尾词上添加锚文本,锚文本又称锚文本链接,是链接的一种形式.那么描文本的添加对网站优化都有什么好处呢?下面一起来了解一下. 一.锚文本为网站传递权重 ...
- ArcGIS for qml -添加自由文本
源码:https://github.com/sueRimn/ArcGIS-for-qml-demos 实现地图上鼠标点击后添加自由文本功能 版权声明:如需转载,请联系获得授权或者附上原文链接 (没有录 ...
- Java 添加 Excel 文本水印和图片水印及,及其他操作文档
1.e-iceblue 文档地址: Java 添加 Excel 文本水印和图片水印 2.首先,在 pom.xml 文件中配置 Maven 仓库路径. <repositories><r ...
最新文章
- makefile 文件模板
- python py生成及调用pyd(so)文件
- boost::sort模块实现跨并行线程的整数排序速度基准的测试程序
- The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
- java学习(155):序列化
- 数学家眼里的相同与不同
- 5-10transformation中部分函数使用
- Python编程教程:面向对象之高级特性!
- JQuery EasyUI入门
- centos设置服务开机启动失败问题
- 213.打家劫舍II
- 自考计算机软件基础真题,2019年4月自考计算机软件基础考试真题试卷
- Linux自学之旅-基础命令(chown和chgrp)
- 【原创】我所认识的银行业务之旅(票据篇)
- You are a Badass: how to stop doubting your greatness and start living an awesome life, Jen Sincero
- 你的必备技能 —— 方法
- 【验证狼人杀三行定律】
- pt100+51单片机的温控系统程序+仿真图 还带压力显示的
- ssis 转换中文字符乱码_SSIS软件包中的字符映射转换
- 计算机上的查找替换功能快速格式化,Excel 2016中使用查找替换功能应用技巧
热门文章
- 【踩坑速记】开源日历控件,顺便全面解析开源库打包发布到Bintray/Jcenter全过程(新),让开源更简单~...
- repadmin查看域控之间的复制状态
- 分类算法之贝叶斯(Bayes)分类器
- 《我的第一本c++书》读后感
- Qt 4.7.1 和 Mobility 1.1.0 已发布
- lvs mysql 端口_LVS配置及多端口服务配置
- 运筹学状态转移方程例子_强化学习第4期:H-J-B方程
- python中元祖 字典 列表的区别_Python中元祖,列表,字典的区别
- 手机端本地图片或者拍照的上传功能
- [转载] Java获取一个类继承的父类或者实现的接口的泛型参数