发布时间:2019-08-01 17:26:31编辑:auto阅读(2822)
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库 安装非常简单
上一篇: python查询mysql,返回json
下一篇: Python – How to dela
47494
45794
36792
34323
28960
25598
24443
19611
19111
17632
5466°
6048°
5570°
5638°
6573°
5376°
5378°
5884°
5855°
7170°