Skip to main content

Class: ModifyShapeHelper

Defined in: src/helper/modify-shape-helper.ts:69

Helper class for modifying PowerPoint shapes in XML structure Provides various methods for manipulating shape appearance, position, and content

Constructors

Constructor

new ModifyShapeHelper(): ModifyShapeHelper

Returns

ModifyShapeHelper

Methods

elementHasBackground()

static elementHasBackground(element): ShapeBackgroundInfo

Defined in: src/helper/modify-shape-helper.ts:416

Check if the given element has a background which is non-transparent

Parameters

element

Element

The XML element to check

Returns

ShapeBackgroundInfo

ShapeBackgroundInfo


ensureTransformElements()

static ensureTransformElements(element): Element

Defined in: src/helper/modify-shape-helper.ts:175

Creates missing transformation elements (a:off and a:ext) with default values Ensures that a shape has the required XML structure for positioning and sizing

Parameters

element

Element

The XML element to check and modify

Returns

Element

The xfrm element that contains or will contain the transformation data


getElementPlaceholderInfo()

static getElementPlaceholderInfo(element): PlaceholderInfo

Defined in: src/helper/modify-shape-helper.ts:407

Forward placeholder info function

Parameters

element

Element

The XML element to check

Returns

PlaceholderInfo

The PlaceholderInfo object


getElementVisualType()

static getElementVisualType(element): ElementVisualType

Defined in: src/helper/modify-shape-helper.ts:398

Determines the type of visual element in PowerPoint

Parameters

element

Element

The XML element to check

Returns

ElementVisualType

A string identifying the element type


replaceText()

static replaceText(replaceText, options?): (element) => void

Defined in: src/helper/modify-shape-helper.ts:159

Replace tagged text content within modified shape

Parameters

replaceText

ReplaceText | ReplaceText[]

Single replacement or array of replacements

options?

ReplaceTextOptions

Optional configuration for text replacement

Returns

Function that accepts an XML element to modify

(element) => void


rotate()

static rotate(degrees): (element) => void

Defined in: src/helper/modify-shape-helper.ts:300

Rotate a shape by a given angle in degrees

Parameters

degrees

number

Rotation angle in degrees (positive = clockwise, negative = counterclockwise)

Returns

Function that accepts an XML element to modify

(element) => void


roundedCorners()

static roundedCorners(degree): (element) => void

Defined in: src/helper/modify-shape-helper.ts:320

Apply rounded corners to a shape with a specified corner radius

Parameters

degree

number

Corner radius in EMU units (1 cm = 360000 EMU)

Returns

Function that accepts an XML element to modify

(element) => void


setBulletList()

static setBulletList(list): (element) => void

Defined in: src/helper/modify-shape-helper.ts:146

Set content to bulleted list within a shape

Parameters

list

BulletListContent

Array or string content for the bullet list

Returns

Function that accepts an XML element to modify

(element) => void


setOutline()

static setOutline(outline): (element) => void

Defined in: src/helper/modify-shape-helper.ts:98

Set outline (line) properties of an existing shape, picture or placeholder: width, dash style and color.

Creates an <a:ln> element if the shape has none, which is the case whenever the outline was never overridden in PowerPoint and is inherited from the theme or the shape style.

Note: if the shape's outline was explicitly switched off in PowerPoint (<a:ln><a:noFill/></a:ln>), a weight alone stays invisible - pass a color as well. Use ModifyCleanupHelper.removeBorder to drop an outline.

Parameters

outline

ShapeOutline

Width (EMU, 1pt = 12700), dash type and/or color

Returns

Function that accepts an XML element to modify

(element) => void


setPosition()

static setPosition(pos): (element) => void

Defined in: src/helper/modify-shape-helper.ts:233

Set absolute position and size of a shape

Parameters

pos

ShapeCoordinates

Object containing position and size coordinates

Returns

Function that accepts an XML element to modify

(element) => void


setSolidFill()

static setSolidFill(element): void

Defined in: src/helper/modify-shape-helper.ts:75

Set solid fill of modified shape to accent6 color

Parameters

element

Element

XML element representing the shape

Returns

void


setText()

static setText(text): (element) => void

Defined in: src/helper/modify-shape-helper.ts:134

Set text content of a shape

Parameters

text

string

Text string to set as shape content

Returns

Function that accepts an XML element to modify

(element) => void


updatePosition()

static updatePosition(pos): (element) => void

Defined in: src/helper/modify-shape-helper.ts:264

Incrementally update position and size of a shape by adding delta values

Parameters

pos

ShapeCoordinates

Object containing delta values for position and size

Returns

Function that accepts an XML element to modify

(element) => void