Automate it! by Chetan Giridhar
Author:Chetan Giridhar
Language: eng
Format: mobi, epub
Publisher: Packt Publishing
Published: 2018-04-17T09:59:41+00:00
How it works...
In this recipe, we used the blank template to add a two-content layout slide. Let's see what else we did on top of it:
In the code, we used prs.slide_layouts[3] to convey the presentation object, prs, to add a slide with the two content layout. The two-content layout also has a title text, which was updated to Adding a Two Content Slide by using the shapes.title attribute.
Next, we looked at the placeholders. A placeholder is a preformatted container to which content can be added. Placeholders are categories of shape, which means multiple shapes can have placeholders. For instance, an autoshape (circle, as seen in the first recipe) is a placeholder; a picture or graphic frame can be a placeholder. We have two placeholders, one on the left and one on the right, in a two-content slide. We targeted the left one with shapes.placeholders[1] and added a first line This is line 1. to the text frame referenced by shapes.placeholders[1].text_frame.
We then added bulleted lines by adding a paragraph to text_frame with the add_paragraph() method and added the text Again a line 2... at level one and And this is line 3... at level two.
Basically, not all shapes contain text, but finding if a shape supports text can be done using the shape.has_text_frame attribute. In this recipe, we know our shape contains a placeholder that can handle text content. So, we used the text_frame attribute to add the first line of text. Similarly, we used the add_paragraph() method to add the subsequent lines in bulleted fashion using the level attribute.
In the end, we saved the new presentation under the name, two_content.pptx. If you look at the screenshot, we see the bulleted look on the text added to the left text frame on the slide.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9918)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9797)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7784)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7764)
Grails in Action by Glen Smith Peter Ledbrook(7699)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7558)
Windows APT Warfare by Sheng-Hao Ma(6868)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6601)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6469)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6420)
Kotlin in Action by Dmitry Jemerov(5068)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4320)
Functional Programming in JavaScript by Mantyla Dan(4040)
Solidity Programming Essentials by Ritesh Modi(4020)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3812)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3755)
The Ultimate iOS Interview Playbook by Avi Tsadok(3729)
