Each slide in a presentation can contain a number of page elements, each of which is one of:
This page focuses on how to add shapes to a slide, as well as how you can add text to those shapes.
Shapes
A shape is a page element such as a rectangle, arc, arrow, text box, or other defined type of shape. When you create a shape, you specify:
- What type of shape it is, using one of the predefined shape types
- Page element properties: size, transform, and containing "parent" slide ID
- Unique object ID (optional)
The transform
page property defines how the shape is rendered on the page,
including its location and scaling.
For more information about transforms,
see Sizing and Positioning Page Elements.
Text and shapes
Text can appear on a slide in one of two ways:
- Within a shape
- Within a cell in a table
You insert text into a shape or table cell using the insertText request.
Any text autofit settings on the shape are automatically deactivated by requests that can impact how text fits in the shape.
Example
The following example adds a square text box to an existing slide and inserts some text into it.
Apps Script
Go
Java
JavaScript
Node.js
PHP
Python
Ruby
For more information about controlling the size and position of shapes, see Size and Position Shapes.