資源簡介
python3調用win32com查找替換ppt文字,原理是遍歷每一個text文本對象,然后處理。
代碼片段和文件信息
‘‘‘本模塊用于刪除ppt中的關鍵字段‘‘‘
import?win32com.client
def?replace_key_word(file_name?find_str):
‘‘‘搜索并替換ppt中的關鍵字‘‘‘
try:
#創建ppt實例
app?=?win32com.client.Dispatch(‘PowerPoint.Application‘)
app.Visible?=?True
app.DisplayAlerts?=?False
ppt?=?app.Presentations.Open(file_name)
#在全部幻燈片中查找指定關鍵字并刪除
slide_count?=?ppt.Slides.Count
for?i?in?range(1slide_count?+?1):
shape_count?=?ppt.S
- 上一篇:python搜索引擎
- 下一篇:批量google學術論文
評論
共有 條評論