Python inserts a new slide page into the PPT file,

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.