Skip to main content

Show.Shape

Show.Shape is an object type of the Presentation module (Office.show(iframe)). 117 methods.

Remarks​

Methods​

MethodDescription
align(alignType)Aligns the shape relative to the slide.
flip(direction)Flips the shape vertically or horizontally.
getAdjustValues()Returns the adjust values defined on a regular shape and their adjustable ranges.
getAlignH(range)Returns the representative paragraph's horizontal alignment.
getAlignV()Returns the vertical text alignment.
getBold(range)Returns whether the representative run is bold.
getBulletStyle(range)Returns the bullet style of the representative paragraph.
getEffects()Returns the effects applied to the shape.
getFill()Returns the shape fill.
getFirstLineIndent(range)Returns the representative paragraph's first-line indent (UI "first line").
getFontFamily(range)Returns the font name of the representative run.
getFontSize(range)Returns the font size (pt) of the representative run.
getFontStyle(range)Returns the font style of the representative run (the first run the range touches).
getHeight()Returns the shape's height.
getHyperlink()Returns the hyperlink set on the shape.
getItalic(range)Returns whether the representative run is italic.
getLevel(range)Returns the representative paragraph's list level.
getLineCap()Returns the line cap.
getLineColor()Returns the line color.
getLineDash()Returns the line dash type.
getLineJoin()Returns the line join type.
getLineSpacing(range)Returns the representative paragraph's line-spacing value.
getLineSpacingType(range)Returns the representative paragraph's line-spacing type.
getLineStyle()Returns the line style.
getLineWidth()Returns the line width (pt).
getMarginLeft(range)Returns the representative paragraph's left margin (UI "before text").
getParagraphStyle(range)Returns the paragraph format of the representative paragraph (the first paragraph the range touches).
getPlaceholderType()Returns the placeholder type of the shape.
getPresetId()Returns the shape's OOXML preset id (prst).
getRotation()Returns the rotation angle of the shape.
getSpaceAfter(range)Returns the representative paragraph's space after (UI "below paragraph").
getSpaceBefore(range)Returns the representative paragraph's space before (UI "above paragraph").
getStrike(range)Returns the strikethrough type of the representative run.
getText(range)Returns the text as plain text.
getTextboxAutoFit()Returns the text-box auto-fit type.
getTextColor(range)Returns the text color of the representative run.
getTextHyperlink(range)Returns the hyperlink of a text range (counterpart of setTextHyperlink; the returned object can be passed back to copy the link).
getTransform()Returns the position, size, and rotation of the shape.
getUnderline(range)Returns the underline type of the representative run.
getWidth()Returns the shape's width.
getX()Returns the shape's X coordinate.
getY()Returns the shape's Y coordinate.
getZOrderIndex()Returns the z-order index of the shape within its parent (the slide, or the group for a group child).
hasText()Returns whether the shape contains text.
insertSymbol(textOffset, symbol)Inserts a symbol (special character) at the given offset.
insertText(text, textOffset)Inserts text.
isChart()Checks whether this handle is a Chart (a type guard for union narrowing).
isControl()Checks whether this handle is a Control (a type guard for union narrowing).
isDiagram()Checks whether this handle is a Diagram (a type guard for union narrowing).
isFlatTx()Returns whether the text stays flat during 3D rotation.
isFlippedH()Returns whether the shape is flipped horizontally.
isFlippedV()Returns whether the shape is flipped vertically.
isGroup()Checks whether this handle is a Group (a type guard for union narrowing).
isImage()Checks whether this handle is an Image (a type guard for union narrowing).
isLine()Checks whether this handle is a Line (a type guard for union narrowing).
isOleObject()Checks whether this handle is an OleObject (a type guard for union narrowing).
isPlaceholder()Returns whether the shape is a placeholder (title, body frame, etc.).
isShape()Checks whether this handle is a Shape (a type guard for union narrowing).
isTable()Checks whether this handle is a Table (a type guard for union narrowing).
moveBy(distance)Moves the shape by x, y relative to its current position.
remove3d()Removes the shape's 3D effect.
removeEffect(effectType)Removes an effect.
removeFill()Removes the fill (noFill).
removeHyperlink()Removes the shape's hyperlink.
removeLineColor()Removes the line color (noFill).
removeTextHyperlink(range)Removes the text hyperlink.
reorder(order)Changes the shape's z-order (forward/backward).
set3d(scene3d, sp3d)Applies a 3D effect to the shape.
setAdjustValue(name, value)Changes one adjust value of a regular shape.
setAdjustValues(avList)Changes several adjust values of a plain shape at once.
setAlignH(align, range)Sets the text's horizontal alignment.
setAlignV(align)Sets the vertical text alignment.
setBold(enabled, range)Sets bold text.
setBulletStyle(bulletType, subType, startAt, range)Sets the bullet style.
setEffects(effects)Applies the effect object returned by getEffects() as it is (symmetric with getEffects - copies effects from shape to shape).
setFill(fill)Applies a fill object returned by getFill() as is.
setFirstLineIndent(firstLineIndent, range)Sets the indent of the paragraph's first line (UI "First line").
setFlatTx(enabled)Sets whether the text stays flat during 3D rotation.
setFontFamily(fontFamily, range)Sets the font.
setFontSize(fontSize, range)Sets the font size.
setFontStyle(style, range)Sets the font style.
setGlow(glow)Applies a glow effect.
setGradientFill(type, stops, angle)Sets a gradient fill.
setHeight(height)Sets the height of the shape.
setHyperlink(hyperlink)Sets a hyperlink on the shape (counterpart of getHyperlink; the returned object can be passed back to copy a hyperlink).
setImageFill(imageUrl, fillMode, alpha, detail)Sets an image fill.
setInnerShadow(shadow)Applies an inner shadow.
setItalic(enabled, range)Sets italic text.
setLevel(level, range)Sets the list level (outline depth).
setLineCap(lineCap)Sets the line cap.
setLineColor(color, alpha)Sets the line color.
setLineDash(lineDash)Sets the line style (dash).
setLineGradient(type, stops, angle)Sets a gradient fill on the line (border).
setLineJoin(lineJoin)Sets the line join type.
setLineSpacing(lineSpacing, type, range)Sets the line spacing.
setLineStyle(style)Applies a line-style object returned by getLineStyle() as-is (symmetric with getLineStyle - shape-to-shape line copy).
setLineWidth(lineWidth)Sets the line width.
setMarginLeft(marginLeft, range)Sets the left margin of the whole paragraph (UI "Before text").
setOuterShadow(shadow)Applies an outer shadow.
setParagraphStyle(style, range)Sets the paragraph format in one call.
setPatternFill(preset, foreColor, backColor, foreAlpha, backAlpha)Sets a pattern fill.
setReflection(reflection)Applies a reflection effect.
setRotation(rotation)Sets the rotation angle of the shape as an absolute value.
setSoftEdge(softEdge)Applies a soft edge effect.
setSolidFill(color, alpha)Sets the shape fill to a solid color.
setSpaceAfter(spaceAfter, range)Sets the space after the paragraph (UI "below paragraph").
setSpaceBefore(spaceBefore, range)Sets the space before the paragraph (UI "above paragraph").
setStrike(strike, range)Sets strikethrough text.
setText(text, range)Sets the text.
setTextboxAutoFit(autoAlignType)Sets the text box auto-fit type.
setTextColor(color, range)Sets the text color.
setTextHyperlink(hyperlink, range)Sets a hyperlink on text (counterpart of getTextHyperlink; the returned object can be passed back to copy a link).
setTransform(transform)Sets the position, size, and rotation of the shape in one call.
setUnderline(underline, range)Sets underlined text.
setWidth(width)Sets the width of the shape.
setX(x)Sets the X coordinate of the shape as an absolute value.
setY(y)Sets the Y coordinate of the shape as an absolute value.

Method details​

align(alignType)​

Aligns the shape relative to the slide. Ignored for shapes that cannot be moved. Group children also move relative to the slide, not within the group (same as the editor). If a child moves outside its group, the group grows to contain it.

align(alignType: AlignType): Promise<void>;

Parameters

NameTypeDescription
alignTypeAlignTypeAlignment type

Returns

none

flip(direction)​

Flips the shape vertically or horizontally. This toggles the current flip state; read whether it is currently flipped with isFlippedH()/isFlippedV(). Ignored for shapes that cannot be rotated. For a rotated shape the angle is mirrored as well (getRotation() becomes 360 - previous angle).

flip(direction: FlipDirection): Promise<void>;

Parameters

NameTypeDescription
directionFlipDirectionFlip direction

Returns

none

getAdjustValues()​

Returns the adjust values defined on a regular shape and their adjustable ranges. The returned name is used by the adjust-value read and update APIs.

getAdjustValues(): Promise<AdjustValue[] | null>;

Returns

Promise<AdjustValue[] | null> - List of adjust values. null if the target shape is gone (e.g. deleted during collaboration)

getAlignH(range)​

Returns the representative paragraph's horizontal alignment. (Symmetric with setAlignH.)

getAlignH(range?: TextRange): Promise<TextAlignH | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<TextAlignH | null> - Horizontal alignment. null if there is no text/paragraph

getAlignV()​

Returns the vertical text alignment. (counterpart of setAlignV) TextAlignV is a numeric enum where TOP is 0, so check for a value with a null comparison, not a truthiness test.

getAlignV(): Promise<TextAlignV | null>;

Returns

Promise<TextAlignV | null> - Vertical alignment. null if there is no target text

getBold(range)​

Returns whether the representative run is bold. (counterpart of setBold - the effective value including inheritance)

getBold(range?: TextRange): Promise<boolean | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<boolean | null> - Bold state. null if there is no target text or the span is invalid

getBulletStyle(range)​

Returns the bullet style of the representative paragraph. The returned fields can be spread into setBulletStyle(type, subType, startAt). Values are the effective ones including layout/master inheritance; absent values (start number) and values that cannot be passed back (number types outside the presets) are left out. Picture bullets and characters outside the presets are read-only and cannot be applied as is. (see setBulletStyle for the constraints)

getBulletStyle(range?: TextRange): Promise<BulletStyle | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<BulletStyle | null> - Bullet style. null if there is no text/paragraph

getEffects()​

Returns the effects applied to the shape. Only applied effects are included as keys. Each value has the same shape as the argument of the matching setter (setOuterShadow/setInnerShadow/setGlow/setSoftEdge/setReflection/set3d). alpha of shadows and glow is always included even when opaque (0); lengths (pt) and ratios (%) are rounded to one decimal place. If the document carries both outerShadow and innerShadow, both are included (the setters can set only one).

getEffects(): Promise<Effects | null>;

Returns

Promise<Effects | null> - Effect information. An empty object \{\} if no effect is applied; null if the target shape is gone (e.g. deleted during collaboration)

getFill()​

Returns the shape fill. (counterpart of setFill - the returned object can be passed back as is) The per-type setters are setSolidFill/setGradientFill/setImageFill/setPatternFill/removeFill.

getFill(): Promise<Fill | null>;

Returns

Promise<Fill | null> - Fill information. \{ type: FillType.NONE \} for noFill; null if the target shape is gone (e.g. deleted during collaboration)

getFirstLineIndent(range)​

Returns the representative paragraph's first-line indent (UI "first line"). (Symmetric with setFirstLineIndent.)

getFirstLineIndent(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - First-line indent (pt, negative is a hanging indent). null if there is no text/paragraph

getFontFamily(range)​

Returns the font name of the representative run. (counterpart of setFontFamily - the effective value including inheritance)

getFontFamily(range?: TextRange): Promise<string | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<string | null> - Font name. null if there is no target text or the span is invalid

getFontSize(range)​

Returns the font size (pt) of the representative run. (counterpart of setFontSize - the effective value including inheritance)

getFontSize(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - Font size (pt). null if there is no target text or the span is invalid

getFontStyle(range)​

Returns the font style of the representative run (the first run the range touches). (counterpart of setFontStyle) The returned object can be passed as is to another object's setFontStyle. Properties without a value are left out. Values are the effective ones including layout/master/table-style inheritance, so values set directly on the run cannot be singled out.

getFontStyle(range?: TextRange): Promise<FontStyle | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<FontStyle | null> - Font style. An empty object \{\} if there is no run/style; null if the target text is gone (e.g. deleted during collaboration) or the span is invalid

getHeight()​

Returns the shape's height. (Symmetric with setHeight.)

getHeight(): Promise<number | null>;

Returns

Promise<number | null> - Height (px). null if the target shape is gone

Returns the hyperlink set on the shape. The returned object can be passed to setHyperlink as is. Returns null if an unsupported kind (run program, macro, etc.) is attached. Only the click hyperlink (hlinkClick) is read; it is the same target as setHyperlink/removeHyperlink, so a get → set round trip holds (hover-only links are outside this API layer). Text links attached per run are read with Shape.getTextHyperlink.

getHyperlink(): Promise<Hyperlink | null>;

Returns

Promise<Hyperlink | null> - Hyperlink information. null if there is no hyperlink (action)

getItalic(range)​

Returns whether the representative run is italic. (counterpart of setItalic - the effective value including inheritance)

getItalic(range?: TextRange): Promise<boolean | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<boolean | null> - Italic state. null if there is no target text or the span is invalid

getLevel(range)​

Returns the representative paragraph's list level. (Symmetric with setLevel.)

getLevel(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - List level (1–9). null if there is no text/paragraph

getLineCap()​

Returns the line cap. (Symmetric with setLineCap.)

getLineCap(): Promise<LineCap | null>;

Returns

Promise<LineCap | null> - Line cap. null if not set or the target shape is gone

getLineColor()​

Returns the line color. (Symmetric with setLineColor. Use getLineStyle when you also need transparency.)

getLineColor(): Promise<string | null>;

Returns

Promise<string | null> - Line color (hex "#RRGGBB" - scheme colors are resolved to hex). null if there is no line or the target shape is gone

getLineDash()​

Returns the line dash type. (Symmetric with setLineDash.)

getLineDash(): Promise<LineDash | null>;

Returns

Promise<LineDash | null> - Line dash type. null if it is not a LineDash enum value or the target shape is gone

getLineJoin()​

Returns the line join type. (Symmetric with setLineJoin.)

getLineJoin(): Promise<LineJoin | null>;

Returns

Promise<LineJoin | null> - Line join (corner) type. null if not set or the target shape is gone

getLineSpacing(range)​

Returns the representative paragraph's line-spacing value. (Symmetric with setLineSpacing.)

getLineSpacing(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - Line spacing value (MULTIPLE: percent multiple, EXACT: pt). null if there is no text/paragraph

getLineSpacingType(range)​

Returns the representative paragraph's line-spacing type. (Symmetric with setLineSpacing's type.)

getLineSpacingType(range?: TextRange): Promise<LineSpacingType | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<LineSpacingType | null> - Line spacing type. null if there is no text/paragraph

getLineStyle()​

Returns the line style. (counterpart of setLineStyle - the returned object can be passed back as is) The individual setters are setLineColor/setLineGradient/setLineWidth/setLineDash/setLineCap/setLineJoin.

getLineStyle(): Promise<LineStyle | null>;

Returns

Promise<LineStyle | null> - Line style. null if the target shape is gone

getLineWidth()​

Returns the line width (pt). (Symmetric with setLineWidth.)

getLineWidth(): Promise<number | null>;

Returns

Promise<number | null> - Line width (pt). Returned even when the line is noFill. null if the target shape is gone

getMarginLeft(range)​

Returns the representative paragraph's left margin (UI "before text"). (Symmetric with setMarginLeft.)

getMarginLeft(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - Left margin (pt). null if there is no text/paragraph

getParagraphStyle(range)​

Returns the paragraph format of the representative paragraph (the first paragraph the range touches). (counterpart of setParagraphStyle) The returned object can be passed as is to another object's setParagraphStyle. Properties without a value are left out. Values are the effective ones including layout/master inheritance, so values set directly on the paragraph cannot be singled out, and passing them back to the same paragraph does not leave properties equal to the inherited value as direct settings. The list level is not included - it is an inherited preset, not a format value. (see getLevel)

getParagraphStyle(range?: TextRange): Promise<ParagraphStyle | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<ParagraphStyle | null> - Paragraph format. null if there is no text/paragraph

getPlaceholderType()​

Returns the placeholder type of the shape.

getPlaceholderType(): Promise<PlaceholderType | null>;

Returns

Promise<PlaceholderType | null> - Placeholder type. null if the shape is not a placeholder or the target shape is gone

getPresetId()​

Returns the shape's OOXML preset id (prst).

getPresetId(): Promise<string | null>;

Returns

Promise<string | null> - Preset id (prst); null if none

getRotation()​

Returns the rotation angle of the shape. (counterpart of setRotation)

getRotation(): Promise<number | null>;

Returns

Promise<number | null> - Rotation angle (degrees). null if the target shape is gone

getSpaceAfter(range)​

Returns the representative paragraph's space after (UI "below paragraph"). (Symmetric with setSpaceAfter.)

getSpaceAfter(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - Space after the paragraph (pt). null if stored as a multiple (%) or there is no text

getSpaceBefore(range)​

Returns the representative paragraph's space before (UI "above paragraph"). (Symmetric with setSpaceBefore.)

getSpaceBefore(range?: TextRange): Promise<number | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<number | null> - Space before the paragraph (pt). null if stored as a multiple (%) or there is no text

getStrike(range)​

Returns the strikethrough type of the representative run. (counterpart of setStrike - the effective value including inheritance)

getStrike(range?: TextRange): Promise<Strike | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<Strike | null> - Strikethrough type. null if there is no target text or the span is invalid

getText(range)​

Returns the text as plain text. Line breaks between paragraphs are kept, but the line break that ends the last paragraph is not a character and is not included ("" for empty text).

getText(range?: TextRange): Promise<string>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (UTF-16 code unit offsets) (default: the whole text)

Returns

Promise<string> - Text of the span (plain text). "" if there is no text model or the span is empty

getTextboxAutoFit()​

Returns the text-box auto-fit type. (Symmetric with setTextboxAutoFit.)

getTextboxAutoFit(): Promise<AutoFitType | null>;

Returns

Promise<AutoFitType | null> - Auto-fit type. null if there is no target text

getTextColor(range)​

Returns the text color of the representative run. (counterpart of setTextColor - the effective value including inheritance)

getTextColor(range?: TextRange): Promise<string | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<string | null> - Text color (hex "#RRGGBB" - scheme colors are resolved to hex). null if the fill is not solid, there is no target text, or the span is invalid

Returns the hyperlink of a text range (counterpart of setTextHyperlink; the returned object can be passed back to copy the link). With range, the run containing the first character of that range is used; without it, the run containing the first character of the text.

getTextHyperlink(range?: TextRange): Promise<Hyperlink | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to query (default: the first character of the text)

Returns

Promise<Hyperlink | null> - Hyperlink information. null if there is no link, no text, or the action is not exposed

getTransform()​

Returns the position, size, and rotation of the shape. x/y are the top-left corner of the shape regardless of flip, so passing the returned value to another shape's setTransform places both shapes at the same spot. Values are rounded to the editor's input units - size to one decimal place, position to integers. The setters use the same units, so shapes placed more finely (e.g. imported documents) move by that amount when the value is passed back.

getTransform(): Promise<ShapeTransform | null>;

Returns

Promise<ShapeTransform | null> - Position, size, and rotation of the shape. null if the target shape is gone (e.g. deleted during collaboration)

getUnderline(range)​

Returns the underline type of the representative run. (counterpart of setUnderline - the effective value including inheritance)

getUnderline(range?: TextRange): Promise<Underline | null>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to read (default: the whole text)

Returns

Promise<Underline | null> - Underline type. null if there is no target text or the span is invalid

getWidth()​

Returns the shape's width. (Symmetric with setWidth.)

getWidth(): Promise<number | null>;

Returns

Promise<number | null> - Width (px). null if the target shape is gone

getX()​

Returns the shape's X coordinate. (Symmetric with setX.)

getX(): Promise<number | null>;

Returns

Promise<number | null> - X coordinate (px). null if the target shape is gone

getY()​

Returns the shape's Y coordinate. (Symmetric with setY.)

getY(): Promise<number | null>;

Returns

Promise<number | null> - Y coordinate (px). null if the target shape is gone

getZOrderIndex()​

Returns the z-order index of the shape within its parent (the slide, or the group for a group child). 0 is the back; larger values are further to the front.

getZOrderIndex(): Promise<number | null>;

Returns

Promise<number | null> - z-order index. null if the target shape is gone

hasText()​

Returns whether the shape contains text. Uses the same criterion the editor uses for empty text - true when there is only whitespace or two or more empty paragraphs (only line breaks), false when there is a single empty paragraph. Kinds without shape-level text (table, group, chart) are always false. (query tables per cell)

hasText(): Promise<boolean | null>;

Returns

Promise<boolean | null> - Whether text exists. null if the target shape is gone

insertSymbol(textOffset, symbol)​

Inserts a symbol (special character) at the given offset.

insertSymbol(textOffset: number, symbol: string): Promise<void>;

Parameters

NameTypeDescription
textOffsetnumberInsert position offset
symbolstringspecial character to insert (no line break - use insertText to split paragraphs)

Returns

none

insertText(text, textOffset)​

Inserts text. The inserted characters take the run format of the character just before the insertion point.

insertText(text: string, textOffset?: number): Promise<void>;

Parameters

NameTypeDescription
textstringText to insert
textOffset (optional)numberInsert position offset (default: end of the text)

Returns

none

isChart()​

Checks whether this handle is a Chart (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isChart(): Promise<this is Chart>;

Returns

Promise<this is Chart>

isControl()​

Checks whether this handle is a Control (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isControl(): Promise<this is Control>;

Returns

Promise<this is Control>

isDiagram()​

Checks whether this handle is a Diagram (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isDiagram(): Promise<this is Diagram>;

Returns

Promise<this is Diagram>

isFlatTx()​

Returns whether the text stays flat during 3D rotation. (counterpart of setFlatTx)

isFlatTx(): Promise<boolean | null>;

Returns

Promise<boolean | null> - Whether the text stays flat. null if the target shape is gone

isFlippedH()​

Returns whether the shape is flipped horizontally. (calling flip(FlipDirection.HORIZONTAL) toggles this value)

isFlippedH(): Promise<boolean | null>;

Returns

Promise<boolean | null> - Horizontal flip state. null if the target shape is gone

isFlippedV()​

Returns whether the shape is flipped vertically. (calling flip(FlipDirection.VERTICAL) toggles this value)

isFlippedV(): Promise<boolean | null>;

Returns

Promise<boolean | null> - Vertical flip state. null if the target shape is gone

isGroup()​

Checks whether this handle is a Group (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isGroup(): Promise<this is Group>;

Returns

Promise<this is Group>

isImage()​

Checks whether this handle is an Image (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isImage(): Promise<this is Image>;

Returns

Promise<this is Image>

isLine()​

Checks whether this handle is a Line (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isLine(): Promise<this is Line>;

Returns

Promise<this is Line>

isOleObject()​

Checks whether this handle is an OleObject (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isOleObject(): Promise<this is OleObject>;

Returns

Promise<this is OleObject>

isPlaceholder()​

Returns whether the shape is a placeholder (title, body frame, etc.).

isPlaceholder(): Promise<boolean | null>;

Returns

Promise<boolean | null> - Placeholder state. null if the target shape is gone

isShape()​

Checks whether this handle is a Shape (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isShape(): Promise<this is Shape>;

Returns

Promise<this is Shape>

isTable()​

Checks whether this handle is a Table (a type guard for union narrowing). Synchronously inspects the SDK handle's internal discriminator - no postMessage round trip, no await needed.

isTable(): Promise<this is Table>;

Returns

Promise<this is Table>

moveBy(distance)​

Moves the shape by x, y relative to its current position. (Absolute placement is setX / setY.)

moveBy(distance: ShapeMoveDistance): Promise<void>;

Parameters

NameTypeDescription
distanceShapeMoveDistanceDistance to move (px)

Returns

none

remove3d()​

Removes the shape's 3D effect.

remove3d(): Promise<void>;

Returns

none

removeEffect(effectType)​

Removes an effect. Does nothing if that effect is not applied. Only effects the shape holds directly are removed - effects inherited from the shape style (effectRef) cannot be removed, so getEffects() may report an effect that this call leaves untouched.

removeEffect(effectType: EffectType): Promise<void>;

Parameters

NameTypeDescription
effectTypeEffectTypeEffect type to remove

Returns

none

removeFill()​

Removes the fill (noFill).

removeFill(): Promise<void>;

Returns

none

Removes the shape's hyperlink. Text links attached per run are removed with Shape.removeTextHyperlink.

removeHyperlink(): Promise<void>;

Returns

none

removeLineColor()​

Removes the line color (noFill).

removeLineColor(): Promise<void>;

Returns

none

Removes the text hyperlink.

removeTextHyperlink(range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
range (optional)TextRangeText span to clear (default: the whole text)

Returns

none

reorder(order)​

Changes the shape's z-order (forward/backward). Ignored if it is already at the target position.

reorder(order: ShapeZOrder): Promise<void>;

Parameters

NameTypeDescription
orderShapeZOrderReorder type

Returns

none

set3d(scene3d, sp3d)​

Applies a 3D effect to the shape. An omitted scene3d or sp3d argument is not applied.

set3d(scene3d?: Scene3d, sp3d?: Sp3d): Promise<void>;

Parameters

NameTypeDescription
scene3d (optional)Scene3dCamera (rotation) settings. Not applied when omitted
sp3d (optional)Sp3dExtrusion (depth) settings. Not applied when omitted

Returns

none

setAdjustValue(name, value)​

Changes one adjust value of a regular shape. Use setAdjustValues to change several at once.

setAdjustValue(name: string, value: number): Promise<void>;

Parameters

NameTypeDescription
namestringAdjust value name (from getAdjustValues)
valuenumberAdjust value. Rounded to an integer and clamped to the minimum or maximum when outside the allowed range (not clamped when the range is unknown, e.g. min/max from getAdjustValues are null)

Returns

none

setAdjustValues(avList)​

Changes several adjust values of a plain shape at once.

setAdjustValues(avList: AdjustValueUpdate[]): Promise<void>;

Parameters

NameTypeDescription
avListAdjustValueUpdate[]List of adjust values to change

Returns

none

setAlignH(align, range)​

Sets the text's horizontal alignment. With range, applies only to the paragraphs that span covers.

setAlignH(align: TextAlignH, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
alignTextAlignHHorizontal alignment
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setAlignV(align)​

Sets the vertical text alignment. (counterpart of getAlignV)

setAlignV(align: TextAlignV): Promise<void>;

Parameters

NameTypeDescription
alignTextAlignVVertical alignment

Returns

none

setBold(enabled, range)​

Sets bold text.

setBold(enabled: boolean, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
enabledbooleantrue: bold, false: off
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setBulletStyle(bulletType, subType, startAt, range)​

Sets the bullet style. (counterpart of getBulletStyle) Picture bullets (BulletType.BLIP) are a read-only type that cannot be applied and are rejected. Characters outside the CharType presets cannot be applied either (read-only, with no argument to receive them).

setBulletStyle(
bulletType: Exclude<BulletType, "buBlip">,
subType?: NumberedType | CharType,
startAt?: number,
range?: TextRange
): Promise<void>;

Parameters

NameTypeDescription
bulletTypeExclude<BulletType, "buBlip">Bullet type
subType (optional)NumberedType | CharTypeBulletType.AUTO_NUM: numbering type (default NumberedType.NUMBER_WITH_DOT), BulletType.CHAR: bullet character type (default CharType.DOT)
startAt (optional)numberStart number (used only with BulletType.AUTO_NUM) (default: 1)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setEffects(effects)​

Applies the effect object returned by getEffects() as it is (symmetric with getEffects
copies effects from shape to shape). Only the effect keys it carries are applied through the matching setters, and scene3d/sp3d go together through set3d. It does not clear the target's existing effects
for a full copy, remove them first with removeEffect/remove3d and then apply. Passing outerShadow and innerShadow together is not rejected: they are applied in the order outerShadow then innerShadow, so innerShadow always remains.

setEffects(effects?: Effects): Promise<void>;

Parameters

NameTypeDescription
effects (optional)EffectsValue returned by getEffects(). Changes nothing when omitted

Returns

none

setFill(fill)​

Applies a fill object returned by getFill() as is. (counterpart of getFill - copies a fill shape to shape) image reuses the embed from the query result, so it is restored only within the same document. An image without embed has no picture to apply and is rejected (use setImageFill for a new image).

setFill(fill?: Fill): Promise<void>;

Parameters

NameTypeDescription
fill (optional)FillValue returned by getFill(). Changes nothing when omitted

Returns

none

setFirstLineIndent(firstLineIndent, range)​

Sets the indent of the paragraph's first line (UI "First line"). Lines from the second onward follow marginLeft. Positive indents, negative creates a hanging indent, 0 means no indent. To change the depth of a bulleted list, use setLevel.

setFirstLineIndent(firstLineIndent: number, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
firstLineIndentnumberFirst-line indent (pt)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setFlatTx(enabled)​

Sets whether the text stays flat during 3D rotation. (counterpart of isFlatTx)

setFlatTx(enabled: boolean): Promise<void>;

Parameters

NameTypeDescription
enabledbooleantrue keeps the text flat, false turns it off

Returns

none

setFontFamily(fontFamily, range)​

Sets the font.

setFontFamily(fontFamily: string, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
fontFamilystringFont name
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setFontSize(fontSize, range)​

Sets the font size.

setFontSize(fontSize: number, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
fontSizenumberIn pt
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setFontStyle(style, range)​

Sets the font style. For single properties prefer setBold/setItalic/setFontSize/setFontFamily/setTextColor.

setFontStyle(style: FontStyle, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
styleFontStyleFont style settings
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setGlow(glow)​

Applies a glow effect. (counterpart of getEffects().glow - the returned object can be passed back as is) Omitted fields are filled with defaults (see Glow for per-field defaults).

setGlow(glow?: Glow): Promise<void>;

Parameters

NameTypeDescription
glow (optional)GlowGlow settings

Returns

none

setGradientFill(type, stops, angle)​

Sets a gradient fill.

setGradientFill(
type?: GradientType,
stops?: { color: string; pos?: number; alpha?: number }[],
angle?: number
): Promise<void>;

Parameters

NameTypeDescription
type (optional)GradientTypeGradient type (lin/circle/rect/shape) (default: GradientType.LINEAR)
stops (optional){ color: string; pos?: number; alpha?: number }[]Color stops. Distributed evenly when pos is omitted; alpha is transparency (0–100, 0 = opaque) (default: [{ color: "accent1", pos: 0 }, { color: "bg1", pos: 100 }])
angle (optional)numberGradient angle (used only for lin) (default: 45)

Returns

none

setHeight(height)​

Sets the height of the shape. Ignored for shapes that cannot be resized.

setHeight(height: number): Promise<void>;

Parameters

NameTypeDescription
heightnumberHeight (px, rounded to one decimal place)

Returns

none

Sets a hyperlink on the shape (counterpart of getHyperlink; the returned object can be passed back to copy a hyperlink). Unsupported kinds and invalid targets (such as a deleted slide) are ignored. Text links attached per run are set with Shape.setTextHyperlink.

setHyperlink(hyperlink: Hyperlink): Promise<void>;

Parameters

NameTypeDescription
hyperlinkHyperlinkThe same Hyperlink object as returned by getHyperlink(). Ignored if type is missing

Returns

none

setImageFill(imageUrl, fillMode, alpha, detail)​

Sets an image fill.

setImageFill(
imageUrl: string,
fillMode?: ImageFillMode,
alpha?: number,
detail?: ImageFillDetail
): Promise<void>;

Parameters

NameTypeDescription
imageUrlstringImage URL
fillMode (optional)ImageFillModeImage fill mode (default: ImageFillMode.STRETCH)
alpha (optional)numberTransparency (0–100, 0 = opaque) (default: 0)
detail (optional)ImageFillDetailDetail options. offset/scale/mirror/align apply only when fillMode = ImageFillMode.TILE (default: {})

Returns

none - Resolves after the image has been uploaded and the fill applied.

setInnerShadow(shadow)​

Applies an inner shadow. (counterpart of getEffects().innerShadow - the returned object can be passed back as is) Omitted fields are filled with defaults (see InnerShadow for per-field defaults). A shape has one shadow - an existing outer shadow is replaced by the inner shadow.

setInnerShadow(shadow?: InnerShadow): Promise<void>;

Parameters

NameTypeDescription
shadow (optional)InnerShadowShadow settings

Returns

none

setItalic(enabled, range)​

Sets italic text.

setItalic(enabled: boolean, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
enabledbooleantrue: italic, false: off
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setLevel(level, range)​

Sets the list level (outline depth). Every paragraph the range touches gets the same level. Unlike the pt-based indents (setFirstLineIndent/setMarginLeft), the level selects an inherited preset, so changing it brings that level's bullet and font size along and overwrites marginLeft with the new level's value. A value set with setMarginLeft is discarded too, so call setLevel first when using both. (firstLineIndent is kept) Clamped to the range the target text allows (title objects have level 1 only).

setLevel(level: number, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
levelnumberList level (1 = top level to 9)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setLineCap(lineCap)​

Sets the line cap.

setLineCap(lineCap: LineCap): Promise<void>;

Parameters

NameTypeDescription
lineCapLineCapLine cap

Returns

none

setLineColor(color, alpha)​

Sets the line color.

setLineColor(color: string, alpha?: number): Promise<void>;

Parameters

NameTypeDescription
colorstringhex (#RRGGBB) or scheme color
alpha (optional)numberTransparency (0–100, 0 = opaque). Stored to three decimal places (default: keeps the current value)

Returns

none

setLineDash(lineDash)​

Sets the line style (dash).

setLineDash(lineDash: LineDash): Promise<void>;

Parameters

NameTypeDescription
lineDashLineDashLine dash style

Returns

none

setLineGradient(type, stops, angle)​

Sets a gradient fill on the line (border).

setLineGradient(
type?: GradientType,
stops?: { color: string; pos?: number; alpha?: number }[],
angle?: number
): Promise<void>;

Parameters

NameTypeDescription
type (optional)GradientTypeGradient type (lin/circle/rect/shape) (default: GradientType.LINEAR)
stops (optional){ color: string; pos?: number; alpha?: number }[]Color stops. Distributed evenly when pos is omitted; alpha is transparency (0–100, 0 = opaque) (default: [{ color: "accent1", pos: 0 }, { color: "bg1", pos: 100 }])
angle (optional)numberGradient angle (used only for lin) (default: 45)

Returns

none

setLineJoin(lineJoin)​

Sets the line join type.

setLineJoin(lineJoin: LineJoin): Promise<void>;

Parameters

NameTypeDescription
lineJoinLineJoinLine join (corner) type

Returns

none

setLineSpacing(lineSpacing, type, range)​

Sets the line spacing. With range, applies only to the paragraphs that span touches. The unit of lineSpacing depends on the type - a percent multiple for MULTIPLE (150 = 1.5x), pt for EXACT.

setLineSpacing(lineSpacing: number, type?: LineSpacingType, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
lineSpacingnumberLine spacing value (MULTIPLE: percent multiple, EXACT: pt)
type (optional)LineSpacingTypeLine spacing type (default: LineSpacingType.MULTIPLE)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setLineStyle(style)​

Applies a line-style object returned by getLineStyle() as-is (symmetric with getLineStyle - shape-to-shape line copy).

setLineStyle(style?: LineStyle): Promise<void>;

Parameters

NameTypeDescription
style (optional)LineStyleValue returned by getLineStyle(). Changes nothing when omitted

Returns

none

setLineWidth(lineWidth)​

Sets the line width.

setLineWidth(lineWidth: number): Promise<void>;

Parameters

NameTypeDescription
lineWidthnumberLine width (pt)

Returns

none

setMarginLeft(marginLeft, range)​

Sets the left margin of the whole paragraph (UI "Before text"). To indent only the first line, use setFirstLineIndent.

setMarginLeft(marginLeft: number, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
marginLeftnumberLeft margin (pt)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setOuterShadow(shadow)​

Applies an outer shadow. (counterpart of getEffects().outerShadow - the returned object can be passed back as is) Omitted fields are filled with defaults (see OuterShadow for per-field defaults). A shape has one shadow - an existing inner shadow is replaced by the outer shadow.

setOuterShadow(shadow?: OuterShadow): Promise<void>;

Parameters

NameTypeDescription
shadow (optional)OuterShadowShadow settings

Returns

none

setParagraphStyle(style, range)​

Sets the paragraph format in one call. With range, applies only to the paragraphs that span touches. Only properties given a value change. null/undefined mean "no change", and there is no way yet to revert a set value to the inherited state. For single properties, prefer setLineSpacing/setMarginLeft/setFirstLineIndent/setSpaceBefore/setSpaceAfter. The list level is not included because changing it has side effects (bullet, font size). (see setLevel)

setParagraphStyle(style: ParagraphStyle, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
styleParagraphStyleParagraph format settings
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setPatternFill(preset, foreColor, backColor, foreAlpha, backAlpha)​

Sets a pattern fill. (round-trip counterpart of getFill)

setPatternFill(
preset: PatternPreset,
foreColor?: string,
backColor?: string,
foreAlpha?: number,
backAlpha?: number
): Promise<void>;

Parameters

NameTypeDescription
presetPatternPresetPattern preset (apiConstants.PatternPreset)
foreColor (optional)stringForeground color hex (#RRGGBB) or scheme color (defaults to theme accent 1) (default: "accent1")
backColor (optional)stringBackground color hex (#RRGGBB) or scheme color (defaults to theme background 1) (default: "bg1")
foreAlpha (optional)numberForeground transparency (0–100, 0 = opaque) (default: 0)
backAlpha (optional)numberBackground transparency (0–100, 0 = opaque) (default: 0)

Returns

none

setReflection(reflection)​

Applies a reflection effect. (counterpart of getEffects().reflection - the returned object can be passed back as is) Omitted fields are filled with defaults (see Reflection for per-field defaults).

setReflection(reflection?: Reflection): Promise<void>;

Parameters

NameTypeDescription
reflection (optional)ReflectionReflection settings

Returns

none

setRotation(rotation)​

Sets the rotation angle of the shape as an absolute value. Ignored for shapes that cannot be rotated. (counterpart of getRotation)

setRotation(rotation: number): Promise<void>;

Parameters

NameTypeDescription
rotationnumberRotation angle (degrees)

Returns

none

setSoftEdge(softEdge)​

Applies a soft edge effect. (counterpart of getEffects().softEdge - the returned object can be passed back as is) Omitted fields are filled with defaults (see SoftEdge for per-field defaults).

setSoftEdge(softEdge?: SoftEdge): Promise<void>;

Parameters

NameTypeDescription
softEdge (optional)SoftEdgeSoft edge settings

Returns

none

setSolidFill(color, alpha)​

Sets the shape fill to a solid color.

setSolidFill(color: string, alpha?: number): Promise<void>;

Parameters

NameTypeDescription
colorstringhex (#RRGGBB) or scheme color
alpha (optional)numberTransparency (0–100, 0 = opaque). Stored to three decimal places (default: keeps the current value)

Returns

none

setSpaceAfter(spaceAfter, range)​

Sets the space after the paragraph (UI "below paragraph").

setSpaceAfter(spaceAfter: number, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
spaceAfternumberSpace after the paragraph (pt)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setSpaceBefore(spaceBefore, range)​

Sets the space before the paragraph (UI "above paragraph").

setSpaceBefore(spaceBefore: number, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
spaceBeforenumberSpace before the paragraph (pt)
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setStrike(strike, range)​

Sets strikethrough text.

setStrike(strike: Strike, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
strikeStrikeStrikethrough type
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setText(text, range)​

Sets the text. Behaves as follows depending on the arguments.
no range: replaces the whole text with text
with range: replaces only that span with text
when text is an empty string (""), deletes the span instead of replacing it

setText(text: string, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
textstringText to set. An empty string ("") deletes
range (optional)TextRangeText span to replace, where to = from + character count - 1 (0-based). E.g. all of "abc" = {from: 0, to: 2}, the "a" in "abc" = {from: 0, to: 0}. Offsets are UTF-16 code units, so a range that splits a surrogate pair covers the whole character rather than half of it (the same holds for the formatting setters that take a range) (default: the whole text)

Returns

none

setTextboxAutoFit(autoAlignType)​

Sets the text box auto-fit type. Does nothing if the type is already the same.

setTextboxAutoFit(autoAlignType: AutoFitType): Promise<void>;

Parameters

NameTypeDescription
autoAlignTypeAutoFitTypeAuto-fit type

Returns

none

setTextColor(color, range)​

Sets the text color.

setTextColor(color: string, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
colorstringhex (#RRGGBB) or scheme color
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

Sets a hyperlink on text (counterpart of getTextHyperlink; the returned object can be passed back to copy a link). The link is attached per run and shown with hyperlink formatting. Unsupported kinds and invalid targets (such as a deleted slide) are ignored.

setTextHyperlink(hyperlink: Hyperlink, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
hyperlinkHyperlinkThe same Hyperlink object as returned by getTextHyperlink(). Ignored if type is missing
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setTransform(transform)​

Sets the position, size, and rotation of the shape in one call. The value returned by getTransform() can be passed as is. (counterpart of getTransform) Only the fields given a value are applied, in the order size → position → rotation; omitted fields keep their current value. As with the individual setters, each field is ignored on shapes that do not support that operation (resize/move/rotate).

setTransform(transform?: Partial<ShapeTransform>): Promise<void>;

Parameters

NameTypeDescription
transform (optional)Partial<ShapeTransform>Position/size (px) · rotation (degrees)

Returns

none

setUnderline(underline, range)​

Sets underlined text.

setUnderline(underline: Underline, range?: TextRange): Promise<void>;

Parameters

NameTypeDescription
underlineUnderlineUnderline type
range (optional)TextRangeText span to apply to (default: the whole text)

Returns

none

setWidth(width)​

Sets the width of the shape. Ignored for shapes that cannot be resized.

setWidth(width: number): Promise<void>;

Parameters

NameTypeDescription
widthnumberWidth (px, rounded to one decimal place)

Returns

none

setX(x)​

Sets the X coordinate of the shape as an absolute value. Ignored for shapes that cannot be moved. (use moveBy for a relative move)

setX(x: number): Promise<void>;

Parameters

NameTypeDescription
xnumberX coordinate (px, rounded to an integer)

Returns

none

setY(y)​

Sets the Y coordinate of the shape as an absolute value. Ignored for shapes that cannot be moved.

setY(y: number): Promise<void>;

Parameters

NameTypeDescription
ynumberY coordinate (px, rounded to an integer)

Returns

none