Python 官方文档:入门教程 => 点击学习
import win32com from win32com.client import Dispatch, constants ppt = win32com.client.Dispatch('PowerPoint.Application'
import win32com
from win32com.client import Dispatch, constants
ppt = win32com.client.Dispatch('PowerPoint.Application')
ppt.Visible = 1
pptSel = ppt.Presentations.Open("C:\\WEB\\PHPStudy\\WWW\\ppt\\Russia\\1.pptx")
# win32com.client.gencache.EnsuRedispatch('PowerPoint.Application')
#get the ppt's pages
slide_count = pptSel.Slides.Count
for i in range(1,slide_count + 1):
shape_count = pptSel.Slides(i).Shapes.Count
print shape_count
for j in range(1,shape_count + 1):
if pptSel.Slides(i).Shapes(j).HasTextFrame:
s = pptSel.Slides(i).Shapes(j).TextFrame.TextRange.Text
print (s.encode('utf-8')+ "\n")
ppt.Quit()
使用前需要配置win32库 安装非常简单
--结束END--
本文标题: python读取ppt文本内容
本文链接: https://www.lsjlt.com/news/184597.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0