Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import os
  2. import os.path
  3. import win32com
  4. import win32com.client
  5. import time
  6. def ppt2pptx(file):
  7. powerpoint = win32com.client.Dispatch('PowerPoint.Application')
  8. win32com.client.gencache.EnsureDispatch('PowerPoint.Application')
  9. powerpoint.Visible = 1
  10. ppt = powerpoint.Presentations.Open(file)
  11. ppt.SaveAs(file[:-4]+'.pptx')
  12. powerpoint.Quit()
  13. path = 'C:\\Users\\cyy\\Desktop\\ppt\\王克金电子类6章\\'
  14. for subPath in os.listdir(path):
  15. s = os.path.join(path,subPath)
  16. if (s.endswith('.ppt')):
  17. print(s)
  18. ppt2pptx(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement