Skip to content

Class: Placeholder ​

One placeholder shape (p:sp with a p:ph) of a slide master or slide layout — the definition a slide's placeholder of the same type/idx inherits geometry and text style from. Geometry getters read the placeholder's own a:xfrm, which a master/layout placeholder carries explicitly (so it round-trips, unlike a notes placeholder's inherited geometry).

This is the identity-and-geometry view. The same p:sp also appears in SlideMaster.shapes / SlideLayout.shapes as an AutoShape, which additionally carries the paint surface (resolvedFill, resolvedLine, presetGeometry, rotation, absoluteFrame) and reports its p:ph through AutoShape.placeholder. Read a placeholder here to place it; read it there to draw it.

Extended by ​

Constructors ​

Constructor ​

new Placeholder(sp, host): Placeholder

Parameters ​

ParameterTypeDescription
spElementThe placeholder's p:sp. protected so NotesPlaceholder can read it.
hostShapeHostThe part the p:sp lives in — a master, a layout, or a notes slide.

Returns ​

Placeholder

Accessors ​

element_ ​

Get Signature ​

get element_(): Element

Escape hatch: the underlying p:sp element. After mutating it call markDirty, or save() writes the original bytes.

Returns ​

Element


height ​

Get Signature ​

get height(): number | null

Height in EMU (a:ext/@cy), or null when the placeholder carries no own a:xfrm.

Returns ​

number | null


id ​

Get Signature ​

get id(): number | null

Drawing id (p:cNvPr/@id), or null when absent.

Returns ​

number | null


idx ​

Get Signature ​

get idx(): string | null

Placeholder index (p:ph/@idx), or null when unset.

Not forwarded to AutoShape.placeholder, whose idx defaults to '0' the way PowerPoint resolves it. Here the absence is the contract: this view reports what the part says.

Returns ​

string | null


left ​

Get Signature ​

get left(): number | null

Left edge in EMU (a:off/@x), or null when the placeholder carries no own a:xfrm.

Returns ​

number | null


name ​

Get Signature ​

get name(): string

Shape name (p:cNvPr/@name), or '' when unnamed.

Returns ​

string


textFrame ​

Get Signature ​

get textFrame(): TextFrame | null

The placeholder's text as a navigable TextFrame (p:txBody), or null when it carries no text body. Threaded with the owning tier's theme context and placeholder identity, so a run's resolved* getters walk the same inheritance chain they walk through SlideMaster.shapes.

Returns ​

TextFrame | null


top ​

Get Signature ​

get top(): number | null

Top edge in EMU (a:off/@y), or null when the placeholder carries no own a:xfrm.

Returns ​

number | null


type ​

Get Signature ​

get type(): string | null

Placeholder type (p:ph/@type: title | body | sldNum | …), or null when absent (a body placeholder).

Returns ​

string | null


width ​

Get Signature ​

get width(): number | null

Width in EMU (a:ext/@cx), or null when the placeholder carries no own a:xfrm.

Returns ​

number | null

Methods ​

markDirty() ​

markDirty(): void

Mark the owning part dirty so save() reserializes it. Call after mutating element_.

Returns ​

void