Python inserts a new slide page into the PPT file,
This example describes how to insert a new slide page to a PPT file using python. Share it with you for your reference. The specific implementation method is as follows:
#-*-Coding: UTF-8-*-import win32com. clientimport win32com. client. dynamicimport OS # My example (Template) File Name: BugCurve.pptx def PowerPoint (): ppt = OS. path. join (OS. getcwd (), "BugCurve.pptx") App = win32com. client. dispatch ("PowerPoint. application ") App. visible = True Presentation = App. presentations. open (ppt) mySlide = Presentation. slides. add (2, 12) # Add a Slide for this Presentation, and insert the position on the second page. # that is, after the cover (the first page), the magic number 12 is .. # Tell the PPT that page is blank page img = OS. path. join (OS. getcwd (), "This_is_Picture.png") shape = mySlide. shapes. addPicture (img, LinkToFile = False, SaveWithDocument = True, Left = 40, Top = 100, Width = 650, Height = 400) # Add a shape in mySlide) specify the size and position of the frame. # Then, place the shape content into the image.
I hope this article will help you with Python programming.