python ppt自动生成_如何自动化生成PPT缩略图?
搜到的代碼,可能得自己改一下.
'' 導出當前文件夾下所有 PowerPoint 演示文稿的第一張幻燈片
'' 并以圖形文件格式保存在當前文件夾下
'' 變量聲明和初始化
Dim wShell, pptApp, fso, folder, file, slide, outFile
Set wShell = WScript.CreateObject("WScript.Shell")
'' 獲取當前文件夾
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(wShell.CurrentDirectory)
Set fso = Nothing
'MsgBox(folder.Path)
'' 打開 PowerPoint 應用程序
Set pptApp = WScript.CreateObject("PowerPoint.Application")
pptApp.Activate
'' 遍歷當前文件夾下所有文件
For Each file in folder.Files
'' 如果文件擴展名為 ppt(根據實際需要和 PowerPoint 程序版本,還可以是 pps, pptx 等)
If UCase(Mid(file.Name, InstrRev(file.Name, ".") + 1)) = "PPT" Then
' MsgBox(file.Name)
'' 設置輸出文件名,此處使用原演示文稿名稱
outFile = Trim(Left(file.Path, InStrRev(file.Path, ".") - 1)) & ".jpg"
' MsgBox(outFile)
pptApp.Presentations.Open file.Path
'' 此處只需要第一張幻燈片
Set slide = pptApp.ActivePresentation.Slides(1)
'' 如果需要導出多張幻燈片,使用如下循環
' For Each slide in pptApp.ActivePresentation.Slides.Range(1)
'' Export(String FileName, String FilterName, Long ScaleWidth, Long ScaleHeight)
'' FilterName 可以為 gif, jpg, png, bmp, wmf, tif 等。
slide.Export outFile, "jpg", 320, 240
' Next
pptApp.Presentations(1).Close
End If
Next
'' 退出 PowerPoint 應用程序
pptApp.Quit
'' 清理對象
Set pptApp = Nothing
Set wShell = Nothing
總結
以上是生活随笔為你收集整理的python ppt自动生成_如何自动化生成PPT缩略图?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vs中html如何设计分页_如何在电路设
- 下一篇: 厦门大学计算机考研怎么样6,【图片】一战