Skip to main content

Variable: modify

const modify: object

Defined in: src/index.ts:152

Type Declaration​

addHyperlink: (target, isInternalLink?) => ShapeModificationCallback

Add a hyperlink to an element

Parameters​

target​

string | number

The target URL for external links, or slide number for internal links

boolean

Returns​

ShapeModificationCallback

A callback function that adds a hyperlink

adjustHeight​

adjustHeight: (data) => (element) => void

Parameters​

data​

TableData

Returns​

(element) => void

adjustWidth​

adjustWidth: (data) => (element) => void

Parameters​

data​

TableData

Returns​

(element) => void

dump​

dump: (element) => void

Dump current element to console.

Parameters​

element​

Document | Element

Returns​

void

dumpChart​

dumpChart: (element, chart) => void

Dump current chart to console.

Parameters​

element​

Document | Element

chart​

Document

Returns​

void

htmlToMultiText​

htmlToMultiText: (html) => (element, relation?) => void

Parameters​

html​

string

Returns​

(element, relation?) => void

minimizeChartLegend​

minimizeChartLegend: () => ChartModificationCallback

Set legend coordinates to zero. Could be advantageous for pptx users to be able to maximize a legend easily. Legend will still be selectible for a user.

Returns​

ChartModificationCallback

removeChartLegend​

removeChartLegend: () => ChartModificationCallback

Completely remove a chart legend. Please notice: This will trigger PowerPoint to automatically maximize chart space.

Returns​

ChartModificationCallback

removeDataLabels​

removeDataLabels: () => ChartModificationCallback

Remove datalabels of a chart.

Returns​

ChartModificationCallback

removeHyperlink: () => ShapeModificationCallback

Remove hyperlinks from an element

Returns​

ShapeModificationCallback

A callback function that removes hyperlinks

replaceText​

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

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

rotateShape​

rotateShape: (degrees) => (element) => void

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

setAttribute​

setAttribute: (tagName, attribute, value, count?) => (element) => void

Set value of an attribute.

Parameters​

tagName​

string

specify the tag name to search for

attribute​

string

name of target attribute

value​

string | number

the value to be set on the attribute

count?​

number

specify if element index is different to zero

Returns​

(element) => void

setAxisRange​

setAxisRange: (range) => ChartModificationCallback

Set range and format for chart axis. Please notice: It will only work if the value to update is not set to "Auto" in powerpoint. Only manually scaled min/max can be altered by this. See __tests__/modify-chart-axis.test.js

Parameters​

range​

ChartAxisRange

Returns​

ChartModificationCallback

setBulletList​

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

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

setChartBubbles​

setChartBubbles: (data) => ChartModificationCallback

Set chart data to modify bubble charts. See __tests__/modify-chart-bubbles.test.js

Parameters​

data​

ChartData

Returns​

ChartModificationCallback

setChartCombo​

setChartCombo: (data) => ChartModificationCallback

Set chart data to modify combo charts. This type is prepared for first series: bar chart (e.g. total) other series: vertical lines See __tests__/modify-chart-scatter.test.js

Parameters​

data​

ChartData

Returns​

ChartModificationCallback

setChartData​

setChartData: (data) => ChartModificationCallback

Set chart data to modify default chart types. See __tests__/modify-existing-chart.test.js

Parameters​

data​

ChartData

Returns​

ChartModificationCallback

setChartScatter​

setChartScatter: (data) => ChartModificationCallback

Set chart data to modify scatter charts. See __tests__/modify-chart-scatter.test.js

Parameters​

data​

ChartData

Returns​

ChartModificationCallback

setChartTitle​

setChartTitle: (newTitle) => ChartModificationCallback

Set the title of a chart. This requires an already existing, manually edited chart title.

Parameters​

newTitle​

string

Returns​

ChartModificationCallback

setChartVerticalLines​

setChartVerticalLines: (data) => ChartModificationCallback

Set chart data to modify vertical line charts. See __tests__/modify-chart-vertical-lines.test.js

Parameters​

data​

ChartData

Returns​

ChartModificationCallback

setDataLabelAttributes​

setDataLabelAttributes: (dataLabel) => ChartModificationCallback

Specify a format for DataLabels

Parameters​

dataLabel​

ChartSeriesDataLabelAttributes

Returns​

ChartModificationCallback

setDuotoneFill​

setDuotoneFill: (duotoneParams) => (element) => void

Parameters​

duotoneParams​
color?​

Color

prstClr?​

string

satMod?​

number

tint?​

number

Returns​

(element) => void

setExtendedChartData​

setExtendedChartData: (data) => ChartModificationCallback

Set chart data to modify extended chart types. See __tests__/modify-existing-extended-chart.test.js

Parameters​

data​

ChartData

Returns​

ChartModificationCallback

setHyperlinkTarget​

setHyperlinkTarget: (target, isExternal) => ShapeModificationCallback

Set the target URL of a hyperlink

Parameters​

target​

string | number

The new target URL for the hyperlink

isExternal?​

boolean = true

Whether the hyperlink is external (true) or internal (false)

Returns​

ShapeModificationCallback

A callback function that modifies the hyperlink

setLegendPosition​

setLegendPosition: (legendArea) => ChartModificationCallback

Update the coordinates of a chart legend. legendArea coordinates are shares of chart coordinates, e.g. "w: 0.5" means "half of chart width"

Parameters​

legendArea​

ShapeCoordinates

Returns​

ChartModificationCallback

setMultiText​

setMultiText: (paragraphs) => (element, relation?) => void

Parameters​

paragraphs​

MultiTextParagraph[]

Returns​

(element, relation?) => void

setOutline​

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

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

setPlotArea​

setPlotArea: (plotArea) => ChartModificationCallback

Set the plot area coordinates of a chart.

This modifier requires a 'c:manualLayout' element. It will only appear if plot area coordinates are edited manually in ppt before. Recently fresh created charts will not have a manualLayout by default.

This is especially useful if you have problems with edgy elements on a chart area that do not fit into the given space, e.g. when having a lot of data labels. You can increase the chart and decrease the plot area to create a margin.

plotArea coordinates are shares of chart coordinates, e.g. "w: 0.5" means "half of chart width"

Parameters​

plotArea​

ShapeCoordinates

Returns​

ChartModificationCallback

setPosition​

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

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

setRelationTarget​

setRelationTarget: (filename) => (element, arg1) => void

Update the "Target" attribute of a created image relation. This will change the image itself. Load images with Automizer.loadMedia

Parameters​

filename​

string

name of target image in root template media folder.

Returns​

(element, arg1) => void

setSolidFill​

setSolidFill: (element) => void

Set solid fill of modified shape to accent6 color

Parameters​

element​

Element

XML element representing the shape

Returns​

void

setTable​

setTable: (data, params?) => (element) => void

Parameters​

data​

TableData

params?​

ModifyTableParams

Returns​

(element) => void

setTableData​

setTableData: (data) => (element) => void

Parameters​

data​

TableData

Returns​

(element) => void

setText​

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

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

setWaterFallColumnTotalToLast​

setWaterFallColumnTotalToLast: (TotalColumnIDX?) => ChartModificationCallback

Set a waterfall Total column to last you may also optionally specify a different index.

Parameters​

TotalColumnIDX?​

number

Returns​

ChartModificationCallback

updateColumnWidth​

updateColumnWidth: (index, size) => (element) => void

Parameters​

index​

number

size​

number

Returns​

(element) => void

updatePosition​

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

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

updateRowHeight​

updateRowHeight: (index, size) => (element) => void

Parameters​

index​

number

size​

number

Returns​

(element) => void