你好,我是UP:法学院毕业的Python程序员兆锋(点击查看🏆近期的付费答疑记录),
如有学习问题,欢迎加入学习群和我交流❤交流群
主要内容
关于PPT这个主题,我们的美女老师还专门录了一个专题视频,请移步:
- python-pptx库 | PPT与Python的完美结合,PPT自动化办公教程
视频内容
点击下方链接,直达本讲视频
点击查看【bilibili】本讲代码
```-- coding: utf-8 --
@Time : 2020/8/22 10:03
@公众号 :Python自动化办公社区
@File : ppt_img.py
@Software: PyCharm
@Description:
pip install python-pptx
from pptx import Presentation from pptx.util import Inches,Pt
ppt = Presentation() slide = ppt.slides.add_slide(ppt.slide_layouts[1])# 在PPT中插入一个幻灯片
left = Inches(1)
top = Inches(1)
width = Inches(2)
height = Inches(2)
#
img = slide.shapes.add_picture(‘img.jpg’,left,top,width,height)
rows = 2 cols = 2 left = Inches(1) top = Inches(1) width = Inches(4) height = Inches(4)
table = slide.shapes.add_table(rows,cols,left,top,width,height).table table.columns[0].width = Inches(1) table.columns[1].width = Inches(3) table.cell(0,0).text = ‘00’ table.cell(0,1).text = ‘01’ table.cell(1,0).text = ‘10’ table.cell(1,1).text = ‘11’ #二进制的11,代表十进制的多少?
ppt.save(‘text.pptx’)
```
配套文档
拓展内容
- Pandas官方文档中文版PDF下载
- 详解 | Python&PyCharm的软件下载和安装
- 我在视频中用的代码字体和页面主题
- 🌈彩蛋文件夹,全是自动化办公干货,不点后悔系列
- Python知识星球👉点击直达
提问与答疑
提供以下3种交流方式: