Skip to content
Document Authoring DA  API Docs v1.22.2
npmGitHub

ActionCalls>= v1.23.0

ActionCalls:

{
formatting.text-color(color: `#${string}` | "none" | null): ActionCall;
formatting.highlight-color(color: `#${string}` | "none" | null): ActionCall;
insert.field(rule: "pageNum" | "pageCount" | "toc"): ActionCall;
comment.reply(commentId: string, replyText: string): ActionCall;
comment.edit(commentId: string, newText: string): ActionCall;
table.set-cell-background(color: `#${string}` | "none" | null): ActionCall;
table.set-cell-border(side: CellBorderSide, color: `#${string}` | "none" | null): ActionCall;
table.set-cell-border-radius(corners: "outer" | "inner", points: number): ActionCall;
layout.apply-list-preset(preset: "Bullet" | "Diamond" | "Arrow" | "Star" | "Arrowhead" | "DecimalAndDot" | "LetterAndDot" | "RomanAndDot" | "DecimalAndParenthesis" | "DecimalZero" | "DecimalDeep"): ActionCall;
layout.page-size(size: "Letter" | "A4" | "A5" | "A6"): ActionCall;
layout.page-orientation(orientation: "portrait" | "landscape"): ActionCall;
layout.header-footer-distance(part: "header" | "footer", points: number): ActionCall;
shape.set-fill-color(color: `#${string}` | null): ActionCall;
shape.set-outline-color(color: `#${string}` | null): ActionCall;
shape.set-wrapping(mode: "inline" | "square" | "topAndBottom" | "behind" | "front"): ActionCall;
object.set-wrapping(mode: "inline" | "square" | "topAndBottom" | "behind" | "front", offset?: { x: number; y: number }): ActionCall;
object.arrange(order: "front" | "forward" | "back" | "backward"): ActionCall;
field.change(rule: "pageNum" | "pageCount"): ActionCall;
spellcheck.replace(clusterBegin: number, clusterEnd: number, replacement: string): ActionCall;
paragraph.set-shading(color: `#${string}` | "none" | null): ActionCall;
paragraph.set-border-color(side: ParagraphBorderSide, color: `#${string}` | "none" | null): ActionCall;
paragraph.set-border-radius(corners: "Outer" | "Inner", points: number): ActionCall;
paragraph.set-indent(side: "left" | "right" | "first-line", points: number): ActionCall;
paragraph.change-tab-stops(changes: { from?: { position: number; alignment: "left" | "center" | "right" | "decimal" | "bar"; leader: "none" | "dot" | "heavy" | "hyphen" | "middleDot" | "underscore" }; to?: { position: number; alignment: "left" | "center" | "right" | "decimal" | "bar"; leader: "none" | "dot" | "heavy" | "hyphen" | "middleDot" | "underscore" } }[]): ActionCall;
}

The built-in actions and the arguments they take. Each method is named by a BuiltInActionId and returns an ActionCall for editor.executeAction(). Use the actionCalls value to build calls.

Text and paragraph actions apply to the current selection. Distances are in points (1/72 inch) unless a parameter says otherwise.

import { actionCalls } from '@nutrient-sdk/document-authoring';
await editor.executeAction(actionCalls['formatting.bold'](true));
await editor.executeAction(actionCalls['layout.page-margin']('l', 72));

document.undo(): ActionCall

Undoes the last change.

ActionCall


document.redo(): ActionCall

Redoes the last undone change.

ActionCall


document.export-pdf(): ActionCall

Downloads the document as a PDF file.

ActionCall


document.export-docx(): ActionCall

Downloads the document as a DOCX file.

ActionCall


document.export-markdown(): ActionCall

Downloads the document as a Markdown file.

ActionCall


document.export-rtf(): ActionCall

Downloads the document as an RTF file.

ActionCall


document.export-odt(): ActionCall

Downloads the document as an ODT file.

ActionCall


edit.cut(): ActionCall

Cuts the selected text to the clipboard. Runs when text is selected. Backs the Cut item of the context menu. Mod+X is handled by the editor directly and doesn’t run this action.

ActionCall


edit.copy(): ActionCall

Copies the selected text to the clipboard. Runs when text is selected. Backs the Copy item of the context menu. Mod+C is handled by the editor directly and doesn’t run this action.

ActionCall


edit.paste(): ActionCall

Pastes the clipboard content at the cursor. Runs when the document has a cursor. Backs the Paste item of the context menu. Mod+V is handled by the editor directly and doesn’t run this action.

ActionCall


edit.paste-without-formatting(): ActionCall

Pastes the text on the clipboard at the cursor, without its formatting. Runs when the document has a cursor. Backs the Paste without formatting item of the context menu.

ActionCall


edit.delete(): ActionCall

Deletes the selected text. Runs when text is selected. Backs the Delete item of the context menu. Backspace is handled by the editor directly and doesn’t run this action.

ActionCall


formatting.font-family(fontFamily): ActionCall

Sets the font of the selected text.

string

The font family name, such as 'Arial'. Must not be empty.

ActionCall


formatting.font-size(points): ActionCall

Sets the font size of the selected text.

number

The font size in points. Must be greater than 0.

ActionCall


formatting.bold(value?): ActionCall

Makes the selected text bold or removes bold.

boolean

true to apply bold, false to remove it. Omit to toggle it.

ActionCall


formatting.italic(value?): ActionCall

Makes the selected text italic or removes italic.

boolean

true to apply italic, false to remove it. Omit to toggle it.

ActionCall


formatting.underline(value?): ActionCall

Underlines the selected text or removes the underline.

boolean

true to apply the underline, false to remove it. Omit to toggle it.

ActionCall


formatting.strikethrough(value?): ActionCall

Strikes through the selected text or removes the strikethrough.

boolean

true to apply the strikethrough, false to remove it. Omit to toggle it.

ActionCall


formatting.subscript(value?): ActionCall

Makes the selected text subscript or puts it back on the baseline.

boolean

true to make the text subscript, false to put it on the baseline. Omit to toggle it.

ActionCall


formatting.superscript(value?): ActionCall

Makes the selected text superscript or puts it back on the baseline.

boolean

true to make the text superscript, false to put it on the baseline. Omit to toggle it.

ActionCall


formatting.text-color(color): ActionCall

Sets the color of the selected text.

A hex color. 'none' or null removes the color set on the text, so it shows the color from its style.

`#${string}` | "none" | null

ActionCall


formatting.highlight-color(color): ActionCall

Sets the highlight color of the selected text.

An opaque hex color with 3 or 6 digits. 'none' sets no highlight, which also hides a highlight from the text’s style, as the toolbar does. null removes only the highlight set on the text, so a highlight from its style shows again.

`#${string}` | "none" | null

ActionCall


formatting.clear(): ActionCall

Removes the formatting set directly on the selected text and its paragraphs, but keeps their paragraph styles.

ActionCall


insert.line-break(): ActionCall

Inserts a line break at the cursor.

ActionCall


insert.page-break(): ActionCall

Inserts a page break at the cursor.

ActionCall


insert.section-break-next-page(): ActionCall

Inserts a section break at the cursor. The new section starts on the next page.

ActionCall


insert.image(): ActionCall

Opens a file picker and inserts the chosen PNG or JPEG image at the cursor.

ActionCall


insert.link(): ActionCall

Opens the link editor to add a hyperlink to the selection or at the cursor.

ActionCall


insert.shape(): ActionCall

Inserts a rectangle shape at the cursor.

ActionCall


insert.text-box(): ActionCall

Inserts a text box at the cursor.

ActionCall


insert.field(rule): ActionCall

Inserts a field at the cursor.

'pageNum' for the current page number, 'pageCount' for the number of pages, or 'toc' for a table of contents.

"pageNum" | "pageCount" | "toc"

ActionCall


insert.comment(): ActionCall

Opens the comment editor to comment on the selected text.

ActionCall


comment.reply(commentId, replyText): ActionCall

Replies to a comment.

string

The ID of the comment. Must not be empty.

string

The reply text. Must not be empty.

ActionCall


comment.edit(commentId, newText): ActionCall

Changes the text of a comment or reply.

string

The ID of the comment or reply. Must not be empty.

string

The replacement text. Must not be empty.

ActionCall


comment.resolve(commentId): ActionCall

Resolves an open comment or reopens a resolved comment.

string

The ID of the comment. Must not be empty.

ActionCall


comment.delete(commentId): ActionCall

Deletes a comment or reply.

string

The ID of the comment or reply. Must not be empty.

ActionCall


revision.accept(revisionId): ActionCall

Accepts a tracked change. The built-in availability check consults canPerformTrackedChange; supplying a custom isEnabled replaces that check. Core still enforces the permission when the built-in handler runs.

string

The ID of the tracked change. Must not be empty.

ActionCall


revision.reject(revisionId): ActionCall

Rejects a tracked change. The built-in availability check consults canPerformTrackedChange; supplying a custom isEnabled replaces that check. Core still enforces the permission when the built-in handler runs.

string

The ID of the tracked change. Must not be empty.

ActionCall


link.edit(): ActionCall

Opens the link editor for the link at the cursor. Runs when the cursor, or the start of the selection, is in a link. Backs the Edit button of the link toolbar and the Edit link item of the context menu.

ActionCall


link.remove(): ActionCall

Removes the link at the cursor and keeps its text. With text selected, removes the links from the selected text. Runs when the cursor, or the start of the selection, is in a link. Backs the Remove button of the link toolbar and the Remove link item of the context menu.

ActionCall


link.open(): ActionCall

Opens the link at the cursor in a new browser tab. Opens http, https and mailto links, and adds https:// to a link without a scheme. Runs when the cursor, or the start of the selection, is in a link it can open. Backs the Open link item of the context menu. The link toolbar’s link and Alt+Enter open the link without running this action.

ActionCall


link.copy(): ActionCall

Copies the URL of the link at the cursor to the clipboard: the URL link.open would open, or the link as stored when link.open can’t open it. Runs when the cursor, or the start of the selection, is in a link. Backs the Copy button of the link toolbar and the Copy link URL item of the context menu.

ActionCall


table.insert(): ActionCall

Inserts a table with 3 rows and 3 columns at the cursor.

ActionCall


table.delete(): ActionCall

Deletes the table that contains the cursor.

ActionCall


table.insert-row-above(): ActionCall

Inserts a row above the current row.

ActionCall


table.insert-row-below(): ActionCall

Inserts a row below the current row.

ActionCall


table.insert-column-left(): ActionCall

Inserts a column to the left of the current column.

ActionCall


table.insert-column-right(): ActionCall

Inserts a column to the right of the current column.

ActionCall


table.delete-row(): ActionCall

Deletes the selected rows, or the row that contains the cursor.

ActionCall


table.delete-column(): ActionCall

Deletes the selected columns, or the column that contains the cursor.

ActionCall


table.merge-cells(): ActionCall

Merges the selected cells into one cell.

ActionCall


table.split-cells(): ActionCall

Unmerges the merged cells in the selection.

ActionCall


table.set-cell-background(color): ActionCall

Sets the background color of the selected cells.

A hex color. 'none' or null removes the background.

`#${string}` | "none" | null

ActionCall


table.set-cell-border(side, color): ActionCall

Sets the color of one border of the selected cells.

CellBorderSide

The border to change.

A hex color. 'none' or null removes the border.

`#${string}` | "none" | null

ActionCall


table.set-cell-border-width(side, points): ActionCall

Sets the width of one border of the selected cells.

CellBorderSide

The border to change.

number

The width in points. Must be 0 or more.

ActionCall


table.set-cell-border-radius(corners, points): ActionCall

Rounds the corners of the selected cells.

'outer' for the corners on the outside of the selection, 'inner' for the corners where its cells meet.

"outer" | "inner"

number

The corner radius in points. Must be 0 or more.

ActionCall


table.set-cell-padding(side, points): ActionCall

Sets the padding on one side of the selected cells.

BoxSide

The side of the cells.

number

The padding in points. Must be 0 or more.

ActionCall


table.set-wrapping(floating): ActionCall

Makes the current table float, with text wrapping around it, or places it inline.

boolean

true to make the table float, false to place it inline with the text. A table inside a shape can’t float.

ActionCall


table.set-indentation(points): ActionCall

Sets how far the current table is indented from the left margin.

number

The indentation in points. A negative value moves the table into the margin.

ActionCall


table.set-column-width(width): ActionCall

Sets the width of the current column.

The width in points, greater than 0, or null for an automatic width.

number | null

ActionCall


view.zoom(percent): ActionCall

Sets the zoom level.

number

The zoom level in percent, from 50 to 400.

ActionCall


view.zoom-in(): ActionCall

Zooms in to the next zoom level.

ActionCall


view.zoom-out(): ActionCall

Zooms out to the previous zoom level.

ActionCall


view.zoom-reset(): ActionCall

Sets the zoom level to 100%.

ActionCall


view.toggle-ruler(visible?): ActionCall

Shows or hides the ruler. The Show ruler checkbox passes its checked state.

boolean

true to show the ruler, false to hide it. Omit to toggle it.

ActionCall


view.toggle-formatting-marks(visible?): ActionCall

Shows or hides formatting marks, such as paragraph marks.

boolean

true to show the marks, false to hide them. Omit to toggle them.

ActionCall


view.open-command-palette(): ActionCall

Opens the command palette.

ActionCall


view.find(): ActionCall

Opens the find bar. The toolbar’s Find button runs this action to open the bar, but closes the bar without an action.

ActionCall


view.mode.edit(): ActionCall

Switches the editor to edit mode, where changes apply directly.

ActionCall


view.mode.review(): ActionCall

Switches the editor to review mode, where changes are tracked.

ActionCall


view.mode.view(): ActionCall

Switches the editor to view mode, where the document is read-only.

ActionCall


layout.align-left(): ActionCall

Aligns the selected paragraphs to the left.

ActionCall


layout.align-center(): ActionCall

Centers the selected paragraphs.

ActionCall


layout.align-right(): ActionCall

Aligns the selected paragraphs to the right.

ActionCall


layout.align-justify(): ActionCall

Justifies the selected paragraphs.

ActionCall


layout.increase-indent(): ActionCall

Increases the indentation of the selected paragraphs.

ActionCall


layout.decrease-indent(): ActionCall

Decreases the indentation of the selected paragraphs.

ActionCall


layout.bulleted-list(): ActionCall

Makes the selected paragraphs a bulleted list, or removes the list if it already is one.

ActionCall


layout.numbered-list(): ActionCall

Makes the selected paragraphs a numbered list, or removes the list if it already is one.

ActionCall


layout.apply-list-preset(preset): ActionCall

Makes the selected paragraphs a list in the given style.

A bullet style ('Bullet', 'Diamond', 'Arrow', 'Star', 'Arrowhead') or a numbering style (the other values).

"Bullet" | "Diamond" | "Arrow" | "Star" | "Arrowhead" | "DecimalAndDot" | "LetterAndDot" | "RomanAndDot" | "DecimalAndParenthesis" | "DecimalZero" | "DecimalDeep"

ActionCall


layout.continue-numbering(): ActionCall

Makes the current numbered list continue the numbering of the list before it.

ActionCall


layout.line-spacing-single(): ActionCall

Sets single line spacing on the selected paragraphs.

ActionCall


layout.line-spacing-1-5(): ActionCall

Sets 1.5 line spacing on the selected paragraphs.

ActionCall


layout.line-spacing-double(): ActionCall

Sets double line spacing on the selected paragraphs.

ActionCall


layout.line-spacing-at-least(points): ActionCall

Sets a minimum line height on the selected paragraphs. Taller lines keep their height.

number

The minimum line height in points. Must be greater than 0.

ActionCall


layout.line-spacing-exactly(points): ActionCall

Sets a fixed line height on the selected paragraphs.

number

The line height in points. Must be greater than 0.

ActionCall


layout.line-spacing-multiple(factor): ActionCall

Sets the line spacing of the selected paragraphs as a multiple of single spacing.

number

The multiple of single spacing, such as 1.15. Must be greater than 0.

ActionCall


layout.space-before(points): ActionCall

Sets the space above the selected paragraphs.

number

The space in points. Must be 0 or more.

ActionCall


layout.space-after(points): ActionCall

Sets the space below the selected paragraphs.

number

The space in points. Must be 0 or more.

ActionCall


layout.contextual-spacing(value?): ActionCall

Leaves out the space between the selected paragraphs and adjacent paragraphs of the same style, or adds it back.

boolean

true to leave the space out, false to add it back. Omit to toggle it.

ActionCall


layout.page-size(size): ActionCall

Sets the page size of the current section.

The paper size.

"Letter" | "A4" | "A5" | "A6"

ActionCall


layout.page-orientation(orientation): ActionCall

Sets the page orientation of the current section.

The page orientation.

"portrait" | "landscape"

ActionCall


layout.page-margin(side, points): ActionCall

Sets the page margin on one edge of the current section. The ruler runs it when you drag a margin.

BoxSide

The page edge.

number

Distance from the edge, in points. Must be 0 or more.

ActionCall


layout.header-footer-different-first(enabled): ActionCall

Gives the first page of the current section its own header and footer, or stops doing so. Runs while the cursor is in a header or footer, outside review mode.

boolean

true to give the first page its own header and footer, false to stop.

ActionCall


layout.header-footer-different-odd-even(enabled): ActionCall

Gives odd and even pages different headers and footers in the whole document, or stops doing so. Runs while the cursor is in a header or footer, outside review mode.

boolean

true to use different headers and footers, false to stop.

ActionCall


layout.header-footer-distance(part, points): ActionCall

Sets the distance between the page edge and the header or footer of the current section. Runs while the cursor is in a header or footer.

'header' for the distance from the top edge to the header, 'footer' for the distance from the bottom edge to the footer.

"header" | "footer"

number

The distance in points. Must be 0 or more.

ActionCall


layout.default-tab-stop(points): ActionCall

Sets the document’s default tab stop interval. Backs the ruler’s default spacing popover.

number

The interval in points. Must be greater than 0.

ActionCall


style.apply(styleId): ActionCall

Applies a paragraph style to the selected paragraphs.

string

The ID of a style in the document, such as 'Heading 1'.

ActionCall


style.apply-clear(styleId): ActionCall

Applies a paragraph style to the selected paragraphs and removes the formatting set directly on them.

string

The ID of a style in the document, such as 'Heading 1'.

ActionCall


style.update(styleId): ActionCall

Changes a style to match the formatting of the selection.

string

The ID of a style in the document, such as 'Heading 1'.

ActionCall


shape.set-type(preset): ActionCall

Changes the shape type of the selected shape.

ShapePreset

A preset name: 'rect', 'roundRect', 'ellipse', 'triangle', 'rtTriangle', 'diamond', 'parallelogram', 'trapezoid', 'pentagon', 'hexagon', 'octagon', 'star5', 'heart', 'cloud', 'rightArrow', 'leftArrow', 'upArrow', 'downArrow', 'leftRightArrow' or 'wedgeRectCallout'. The selected shape’s current preset is also accepted. Other members of Programmatic.ShapePreset type-check but are rejected at runtime.

ActionCall


shape.set-fill-color(color): ActionCall

Sets the fill color of the selected shape. The fill keeps its transparency.

A hex color, or null to remove the fill.

`#${string}` | null

ActionCall


shape.set-fill-transparency(percent): ActionCall

Sets the transparency of the selected shape’s fill. Runs when the shape has a fill color.

number

From 0 (opaque) to 100 (fully transparent).

ActionCall


shape.set-outline-color(color): ActionCall

Sets the outline color of the selected shape.

A hex color, or null to remove the outline.

`#${string}` | null

ActionCall


shape.set-outline-width(points): ActionCall

Sets the outline width of the selected shape.

number

The width in points. Must be 0 or more. 0 removes the outline.

ActionCall


shape.set-outline-transparency(percent): ActionCall

Sets the transparency of the selected shape’s outline. Runs when the outline has a color.

number

From 0 (opaque) to 100 (fully transparent).

ActionCall


shape.set-text-padding(side, value, unit): ActionCall

Sets the space between one edge of the selected shape and its text.

BoxSide

The edge of the shape.

number

The space, in unit. Must be 0 or more.

Unit

The unit of value.

ActionCall


shape.set-wrapping(mode): ActionCall

Sets how the selected shape sits in the text.

'inline' places the shape in the line of text. The other modes make it float: 'square' wraps text around its box, 'topAndBottom' keeps text above and below it, and 'behind' and 'front' place it behind or in front of the text. A shape inside another shape can only be 'inline'.

"inline" | "square" | "topAndBottom" | "behind" | "front"

ActionCall


object.set-wrapping(mode, offset?): ActionCall

Sets how the selected image or shape sits in the text. Runs when an image or shape is selected, unless it is inline inside a shape’s text. Backs the Text Wrapping menu of the context menu.

'inline' places the object in the line of text. The other modes make it float: 'square' wraps text around its box, 'topAndBottom' keeps text above and below it, and 'behind' and 'front' place it behind or in front of the text. An object inside a shape’s text can only be 'inline'.

"inline" | "square" | "topAndBottom" | "behind" | "front"

Where an inline object goes when it starts to float, in points from the top left corner of the page. Omit to place it in that corner.

number

number

ActionCall


object.arrange(order): ActionCall

Moves the selected floating image or shape in front of or behind the other floating objects. Runs when the selected object floats. Backs the Bring to Front and Send to Back menus of the context menu.

'front' moves the object in front of all the others, 'forward' one step forward, 'backward' one step back, and 'back' behind all the others.

"front" | "forward" | "back" | "backward"

ActionCall


field.update(): ActionCall

Updates the value of the field at the cursor, such as a table of contents. Runs when the cursor is in a field, except a page number or page count field in a header or footer, which updates on every page. Backs the Update field item of the context menu.

ActionCall


field.change(rule): ActionCall

Changes the type of the field at the cursor. Runs when the cursor is in a page number or page count field. Backs the Edit field menu of the context menu.

'pageNum' for the current page number or 'pageCount' for the number of pages.

"pageNum" | "pageCount"

ActionCall


spellcheck.replace(clusterBegin, clusterEnd, replacement): ActionCall

Replaces a misspelled word in the paragraph at the cursor. Backs the spelling suggestions of the context menu and of the popup that opens when you click a misspelled word.

number

Where the word starts, as a character cluster index in the paragraph. A whole number, 0 or more.

number

Where the word ends, as a character cluster index in the paragraph. A whole number, 0 or more.

string

The text to put in place of the word. Must not be empty.

ActionCall


paragraph.set-shading(color): ActionCall

Sets the background color of the selected paragraphs.

A hex color. 'none' or null removes the background.

`#${string}` | "none" | null

ActionCall


paragraph.set-border-color(side, color): ActionCall

Sets the color of one border of the selected paragraphs. A border without a width gets a width of 1 point.

ParagraphBorderSide

The border to change.

A hex color, or null to remove the border. With 'none', the border keeps its width but has no color.

`#${string}` | "none" | null

ActionCall


paragraph.set-border-width(side, points): ActionCall

Sets the width of one border of the selected paragraphs.

ParagraphBorderSide

The border to change.

number

The width in points. Must be 0 or more.

ActionCall


paragraph.set-border-radius(corners, points): ActionCall

Rounds the corners of the border around the selected paragraphs.

'Outer' for the outer corners of the border, 'Inner' for the corners where consecutive bordered paragraphs meet.

"Outer" | "Inner"

number

The corner radius in points. Must be 0 or more.

ActionCall


paragraph.set-indent(side, points): ActionCall

Sets an indent of the paragraphs at the caret or in the selection. Backs the ruler markers. A first-line position left of the left indent creates a hanging indent.

The indent to set.

"left" | "right" | "first-line"

number

The position in points from the left margin, or from the right margin for the right indent. Negative positions are allowed.

ActionCall


paragraph.change-tab-stops(changes): ActionCall

Changes the tab stops of the paragraphs at the caret or in the selection. Backs the ruler’s tab stop markers and popovers. Positions are in points from the left margin.

object[]

A non-empty list. Each change needs from, to, or both. to alone adds a stop, from alone removes a stop matching its position, alignment and leader, and both replace it. A single removal or update leaves paragraphs without a matching stop unchanged; multiple changes rewrite the stops of every selected paragraph.

ActionCall