document.add_shape
Add a shape to a slide and get its new shape ID. Supports text, rect, ellipse, image, connector, arrow, autoshape, freeform, and table kinds with per-kind style props.
Instructions
Add a shape to a slide. Returns the new shape id. kinds: text / rect / ellipse / image (NamedShape subclasses — fill / text / path go in their own fields). kinds: connector / arrow / autoshape (preset shape — pass props.prst). kind: freeform (props.path_ops is a list of [op, *args] tuples: M/L/C/Q/Z). kind: table (rows / cols / cells). Every kind accepts extra props that ride through onto the shape verbatim (rotation, flip_h, fill, stroke, font_size, ln_color, head_end, ...).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| h | No | ||
| w | No | ||
| x | No | ||
| y | No | ||
| cols | No | Table column count (kind=table only). | |
| kind | Yes | ||
| path | No | Image path (kind=image only). | |
| rows | No | Table row count (kind=table only). | |
| text | No | ||
| cells | No | Table cells, 2D list of strings (kind=table only). | |
| props | No | Per-kind style attributes. Common: fill, stroke, stroke_w, font_size, color. connector/arrow/autoshape: ``prst`` (preset name — required for autoshape, default ``'line'`` for connector, ``'rightArrow'`` for arrow). freeform: ``path_ops`` (required, list of [op, *args]). Plus rotation, flip_h, flip_v, ln_color, head_end, tail_end, ln_w_emu, ln_dash, glow, shadow, reflection, etc. | |
| slide_index | No |