将多个PPT文件合并成一个PPT文件
def joinPPT():
'''
http://www.s-anand.net/blog/automating-powerpoint-with-python/
http://support.microsoft.com/kb/161661 太废了,此法不可取
'''
import win32com.client, sys
Application = win32com.client.Dispatch("PowerPoint.Application")
Application.Visible = True
# Create new presentation
new_ppt = Application.Presentations.Add()
from jhl_utils.file_dir import listFiles
files = listFiles('E:\\QA1110',patterns = "*.ppt",recurse=0)
for f in files:
# 先打开一遍读页数
exit_ppt = Application.Presentations.Open(f)
page_num = exit_ppt.Slides.Count
exit_ppt.Close()
#http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.slides.insertfromfile.aspx
num = new_ppt.Slides.InsertFromFile(f,new_ppt.Slides.Count,1,page_num)
#for Slide in Presentation.Slides:
#for Shape in Slide.Shapes:
#Shape.TextFrame.TextRange.Font.Name = "Arial"
Presentation.Save()
Application.Quit()