ActionCalls>= v1.23.0
ActionCalls:
{ layout.apply-list-preset(preset: "Bullet" | "Diamond" | "Arrow" | "Star" | "Arrowhead" | "DecimalAndDot" | "LetterAndDot" | "RomanAndDot" | "DecimalAndParenthesis" | "DecimalZero" | "DecimalDeep"): ActionCall; object.set-wrapping(mode: "inline" | "square" | "topAndBottom" | "behind" | "front", offset?: { x: number; y: number }): ActionCall; paragraph.set-border-color(side: ParagraphBorderSide, color: `#${string}` | "none" | null): 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.
Example
Section titled “Example”
Methods
Section titled “Methods”document.undo()
Section titled “document.undo()”document.undo():
ActionCall
Undoes the last change.
Returns
Section titled “Returns”document.redo()
Section titled “document.redo()”document.redo():
ActionCall
Redoes the last undone change.
Returns
Section titled “Returns”document.export-pdf()
Section titled “document.export-pdf()”document.export-pdf():
ActionCall
Downloads the document as a PDF file.
Returns
Section titled “Returns”document.export-docx()
Section titled “document.export-docx()”document.export-docx():
ActionCall
Downloads the document as a DOCX file.
Returns
Section titled “Returns”document.export-markdown()
Section titled “document.export-markdown()”document.export-markdown():
ActionCall
Downloads the document as a Markdown file.
Returns
Section titled “Returns”document.export-rtf()
Section titled “document.export-rtf()”document.export-rtf():
ActionCall
Downloads the document as an RTF file.
Returns
Section titled “Returns”document.export-odt()
Section titled “document.export-odt()”document.export-odt():
ActionCall
Downloads the document as an ODT file.
Returns
Section titled “Returns”edit.cut()
Section titled “edit.cut()”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.
Returns
Section titled “Returns”edit.copy()
Section titled “edit.copy()”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.
Returns
Section titled “Returns”edit.paste()
Section titled “edit.paste()”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.
Returns
Section titled “Returns”edit.paste-without-formatting()
Section titled “edit.paste-without-formatting()”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.
Returns
Section titled “Returns”edit.delete()
Section titled “edit.delete()”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.
Returns
Section titled “Returns”formatting.font-family()
Section titled “formatting.font-family()”formatting.font-family(
fontFamily):ActionCall
Sets the font of the selected text.
Parameters
Section titled “Parameters”fontFamily
Section titled “fontFamily”The font family name, such as 'Arial'. Must not be empty.
Returns
Section titled “Returns”formatting.font-size()
Section titled “formatting.font-size()”formatting.font-size(
points):ActionCall
Sets the font size of the selected text.
Parameters
Section titled “Parameters”points
Section titled “points”The font size in points. Must be greater than 0.
Returns
Section titled “Returns”formatting.bold()
Section titled “formatting.bold()”formatting.bold(
value?):ActionCall
Makes the selected text bold or removes bold.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to apply bold, false to remove it. Omit to toggle it.
Returns
Section titled “Returns”formatting.italic()
Section titled “formatting.italic()”formatting.italic(
value?):ActionCall
Makes the selected text italic or removes italic.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to apply italic, false to remove it. Omit to toggle it.
Returns
Section titled “Returns”formatting.underline()
Section titled “formatting.underline()”formatting.underline(
value?):ActionCall
Underlines the selected text or removes the underline.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to apply the underline, false to remove it. Omit to toggle it.
Returns
Section titled “Returns”formatting.strikethrough()
Section titled “formatting.strikethrough()”formatting.strikethrough(
value?):ActionCall
Strikes through the selected text or removes the strikethrough.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to apply the strikethrough, false to remove it. Omit to toggle it.
Returns
Section titled “Returns”formatting.subscript()
Section titled “formatting.subscript()”formatting.subscript(
value?):ActionCall
Makes the selected text subscript or puts it back on the baseline.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to make the text subscript, false to put it on the baseline. Omit to toggle it.
Returns
Section titled “Returns”formatting.superscript()
Section titled “formatting.superscript()”formatting.superscript(
value?):ActionCall
Makes the selected text superscript or puts it back on the baseline.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to make the text superscript, false to put it on the baseline. Omit to toggle it.
Returns
Section titled “Returns”formatting.text-color()
Section titled “formatting.text-color()”formatting.text-color(
color):ActionCall
Sets the color of the selected text.
Parameters
Section titled “Parameters”A hex color. 'none' or null removes the color set on the text, so it shows the
color from its style.
Returns
Section titled “Returns”formatting.highlight-color()
Section titled “formatting.highlight-color()”formatting.highlight-color(
color):ActionCall
Sets the highlight color of the selected text.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”formatting.clear()
Section titled “formatting.clear()”formatting.clear():
ActionCall
Removes the formatting set directly on the selected text and its paragraphs, but keeps their paragraph styles.
Returns
Section titled “Returns”insert.line-break()
Section titled “insert.line-break()”insert.line-break():
ActionCall
Inserts a line break at the cursor.
Returns
Section titled “Returns”insert.page-break()
Section titled “insert.page-break()”insert.page-break():
ActionCall
Inserts a page break at the cursor.
Returns
Section titled “Returns”insert.section-break-next-page()
Section titled “insert.section-break-next-page()”insert.section-break-next-page():
ActionCall
Inserts a section break at the cursor. The new section starts on the next page.
Returns
Section titled “Returns”insert.image()
Section titled “insert.image()”insert.image():
ActionCall
Opens a file picker and inserts the chosen PNG or JPEG image at the cursor.
Returns
Section titled “Returns”insert.link()
Section titled “insert.link()”insert.link():
ActionCall
Opens the link editor to add a hyperlink to the selection or at the cursor.
Returns
Section titled “Returns”insert.shape()
Section titled “insert.shape()”insert.shape():
ActionCall
Inserts a rectangle shape at the cursor.
Returns
Section titled “Returns”insert.text-box()
Section titled “insert.text-box()”insert.text-box():
ActionCall
Inserts a text box at the cursor.
Returns
Section titled “Returns”insert.field()
Section titled “insert.field()”insert.field(
rule):ActionCall
Inserts a field at the cursor.
Parameters
Section titled “Parameters”'pageNum' for the current page number, 'pageCount' for the number of pages, or
'toc' for a table of contents.
"pageNum" | "pageCount" | "toc"
Returns
Section titled “Returns”insert.comment()
Section titled “insert.comment()”insert.comment():
ActionCall
Opens the comment editor to comment on the selected text.
Returns
Section titled “Returns”comment.reply()
Section titled “comment.reply()”comment.reply(
commentId,replyText):ActionCall
Replies to a comment.
Parameters
Section titled “Parameters”commentId
Section titled “commentId”The ID of the comment. Must not be empty.
replyText
Section titled “replyText”The reply text. Must not be empty.
Returns
Section titled “Returns”comment.edit()
Section titled “comment.edit()”comment.edit(
commentId,newText):ActionCall
Changes the text of a comment or reply.
Parameters
Section titled “Parameters”commentId
Section titled “commentId”The ID of the comment or reply. Must not be empty.
newText
Section titled “newText”The replacement text. Must not be empty.
Returns
Section titled “Returns”comment.resolve()
Section titled “comment.resolve()”comment.resolve(
commentId):ActionCall
Resolves an open comment or reopens a resolved comment.
Parameters
Section titled “Parameters”commentId
Section titled “commentId”The ID of the comment. Must not be empty.
Returns
Section titled “Returns”comment.delete()
Section titled “comment.delete()”comment.delete(
commentId):ActionCall
Deletes a comment or reply.
Parameters
Section titled “Parameters”commentId
Section titled “commentId”The ID of the comment or reply. Must not be empty.
Returns
Section titled “Returns”revision.accept()
Section titled “revision.accept()”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.
Parameters
Section titled “Parameters”revisionId
Section titled “revisionId”The ID of the tracked change. Must not be empty.
Returns
Section titled “Returns”revision.reject()
Section titled “revision.reject()”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.
Parameters
Section titled “Parameters”revisionId
Section titled “revisionId”The ID of the tracked change. Must not be empty.
Returns
Section titled “Returns”link.edit()
Section titled “link.edit()”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.
Returns
Section titled “Returns”link.remove()
Section titled “link.remove()”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.
Returns
Section titled “Returns”link.open()
Section titled “link.open()”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.
Returns
Section titled “Returns”link.copy()
Section titled “link.copy()”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.
Returns
Section titled “Returns”table.insert()
Section titled “table.insert()”table.insert():
ActionCall
Inserts a table with 3 rows and 3 columns at the cursor.
Returns
Section titled “Returns”table.delete()
Section titled “table.delete()”table.delete():
ActionCall
Deletes the table that contains the cursor.
Returns
Section titled “Returns”table.insert-row-above()
Section titled “table.insert-row-above()”table.insert-row-above():
ActionCall
Inserts a row above the current row.
Returns
Section titled “Returns”table.insert-row-below()
Section titled “table.insert-row-below()”table.insert-row-below():
ActionCall
Inserts a row below the current row.
Returns
Section titled “Returns”table.insert-column-left()
Section titled “table.insert-column-left()”table.insert-column-left():
ActionCall
Inserts a column to the left of the current column.
Returns
Section titled “Returns”table.insert-column-right()
Section titled “table.insert-column-right()”table.insert-column-right():
ActionCall
Inserts a column to the right of the current column.
Returns
Section titled “Returns”table.delete-row()
Section titled “table.delete-row()”table.delete-row():
ActionCall
Deletes the selected rows, or the row that contains the cursor.
Returns
Section titled “Returns”table.delete-column()
Section titled “table.delete-column()”table.delete-column():
ActionCall
Deletes the selected columns, or the column that contains the cursor.
Returns
Section titled “Returns”table.merge-cells()
Section titled “table.merge-cells()”table.merge-cells():
ActionCall
Merges the selected cells into one cell.
Returns
Section titled “Returns”table.split-cells()
Section titled “table.split-cells()”table.split-cells():
ActionCall
Unmerges the merged cells in the selection.
Returns
Section titled “Returns”table.set-cell-background()
Section titled “table.set-cell-background()”table.set-cell-background(
color):ActionCall
Sets the background color of the selected cells.
Parameters
Section titled “Parameters”A hex color. 'none' or null removes the background.
Returns
Section titled “Returns”table.set-cell-border()
Section titled “table.set-cell-border()”table.set-cell-border(
side,color):ActionCall
Sets the color of one border of the selected cells.
Parameters
Section titled “Parameters”The border to change.
A hex color. 'none' or null removes the border.
Returns
Section titled “Returns”table.set-cell-border-width()
Section titled “table.set-cell-border-width()”table.set-cell-border-width(
side,points):ActionCall
Sets the width of one border of the selected cells.
Parameters
Section titled “Parameters”The border to change.
points
Section titled “points”The width in points. Must be 0 or more.
Returns
Section titled “Returns”table.set-cell-border-radius()
Section titled “table.set-cell-border-radius()”table.set-cell-border-radius(
corners,points):ActionCall
Rounds the corners of the selected cells.
Parameters
Section titled “Parameters”corners
Section titled “corners”'outer' for the corners on the outside of the selection, 'inner' for the
corners where its cells meet.
"outer" | "inner"
points
Section titled “points”The corner radius in points. Must be 0 or more.
Returns
Section titled “Returns”table.set-cell-padding()
Section titled “table.set-cell-padding()”table.set-cell-padding(
side,points):ActionCall
Sets the padding on one side of the selected cells.
Parameters
Section titled “Parameters”The side of the cells.
points
Section titled “points”The padding in points. Must be 0 or more.
Returns
Section titled “Returns”table.set-wrapping()
Section titled “table.set-wrapping()”table.set-wrapping(
floating):ActionCall
Makes the current table float, with text wrapping around it, or places it inline.
Parameters
Section titled “Parameters”floating
Section titled “floating”true to make the table float, false to place it inline with the text. A table
inside a shape can’t float.
Returns
Section titled “Returns”table.set-indentation()
Section titled “table.set-indentation()”table.set-indentation(
points):ActionCall
Sets how far the current table is indented from the left margin.
Parameters
Section titled “Parameters”points
Section titled “points”The indentation in points. A negative value moves the table into the margin.
Returns
Section titled “Returns”table.set-column-width()
Section titled “table.set-column-width()”table.set-column-width(
width):ActionCall
Sets the width of the current column.
Parameters
Section titled “Parameters”The width in points, greater than 0, or null for an automatic width.
Returns
Section titled “Returns”view.zoom()
Section titled “view.zoom()”view.zoom(
percent):ActionCall
Sets the zoom level.
Parameters
Section titled “Parameters”percent
Section titled “percent”The zoom level in percent, from 50 to 400.
Returns
Section titled “Returns”view.zoom-in()
Section titled “view.zoom-in()”view.zoom-in():
ActionCall
Zooms in to the next zoom level.
Returns
Section titled “Returns”view.zoom-out()
Section titled “view.zoom-out()”view.zoom-out():
ActionCall
Zooms out to the previous zoom level.
Returns
Section titled “Returns”view.zoom-reset()
Section titled “view.zoom-reset()”view.zoom-reset():
ActionCall
Sets the zoom level to 100%.
Returns
Section titled “Returns”view.toggle-ruler()
Section titled “view.toggle-ruler()”view.toggle-ruler(
visible?):ActionCall
Shows or hides the ruler. The Show ruler checkbox passes its checked state.
Parameters
Section titled “Parameters”visible?
Section titled “visible?”true to show the ruler, false to hide it. Omit to toggle it.
Returns
Section titled “Returns”view.toggle-formatting-marks()
Section titled “view.toggle-formatting-marks()”view.toggle-formatting-marks(
visible?):ActionCall
Shows or hides formatting marks, such as paragraph marks.
Parameters
Section titled “Parameters”visible?
Section titled “visible?”true to show the marks, false to hide them. Omit to toggle them.
Returns
Section titled “Returns”view.open-command-palette()
Section titled “view.open-command-palette()”view.open-command-palette():
ActionCall
Opens the command palette.
Returns
Section titled “Returns”view.find()
Section titled “view.find()”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.
Returns
Section titled “Returns”view.mode.edit()
Section titled “view.mode.edit()”view.mode.edit():
ActionCall
Switches the editor to edit mode, where changes apply directly.
Returns
Section titled “Returns”view.mode.review()
Section titled “view.mode.review()”view.mode.review():
ActionCall
Switches the editor to review mode, where changes are tracked.
Returns
Section titled “Returns”view.mode.view()
Section titled “view.mode.view()”view.mode.view():
ActionCall
Switches the editor to view mode, where the document is read-only.
Returns
Section titled “Returns”layout.align-left()
Section titled “layout.align-left()”layout.align-left():
ActionCall
Aligns the selected paragraphs to the left.
Returns
Section titled “Returns”layout.align-center()
Section titled “layout.align-center()”layout.align-center():
ActionCall
Centers the selected paragraphs.
Returns
Section titled “Returns”layout.align-right()
Section titled “layout.align-right()”layout.align-right():
ActionCall
Aligns the selected paragraphs to the right.
Returns
Section titled “Returns”layout.align-justify()
Section titled “layout.align-justify()”layout.align-justify():
ActionCall
Justifies the selected paragraphs.
Returns
Section titled “Returns”layout.increase-indent()
Section titled “layout.increase-indent()”layout.increase-indent():
ActionCall
Increases the indentation of the selected paragraphs.
Returns
Section titled “Returns”layout.decrease-indent()
Section titled “layout.decrease-indent()”layout.decrease-indent():
ActionCall
Decreases the indentation of the selected paragraphs.
Returns
Section titled “Returns”layout.bulleted-list()
Section titled “layout.bulleted-list()”layout.bulleted-list():
ActionCall
Makes the selected paragraphs a bulleted list, or removes the list if it already is one.
Returns
Section titled “Returns”layout.numbered-list()
Section titled “layout.numbered-list()”layout.numbered-list():
ActionCall
Makes the selected paragraphs a numbered list, or removes the list if it already is one.
Returns
Section titled “Returns”layout.apply-list-preset()
Section titled “layout.apply-list-preset()”layout.apply-list-preset(
preset):ActionCall
Makes the selected paragraphs a list in the given style.
Parameters
Section titled “Parameters”preset
Section titled “preset”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"
Returns
Section titled “Returns”layout.continue-numbering()
Section titled “layout.continue-numbering()”layout.continue-numbering():
ActionCall
Makes the current numbered list continue the numbering of the list before it.
Returns
Section titled “Returns”layout.line-spacing-single()
Section titled “layout.line-spacing-single()”layout.line-spacing-single():
ActionCall
Sets single line spacing on the selected paragraphs.
Returns
Section titled “Returns”layout.line-spacing-1-5()
Section titled “layout.line-spacing-1-5()”layout.line-spacing-1-5():
ActionCall
Sets 1.5 line spacing on the selected paragraphs.
Returns
Section titled “Returns”layout.line-spacing-double()
Section titled “layout.line-spacing-double()”layout.line-spacing-double():
ActionCall
Sets double line spacing on the selected paragraphs.
Returns
Section titled “Returns”layout.line-spacing-at-least()
Section titled “layout.line-spacing-at-least()”layout.line-spacing-at-least(
points):ActionCall
Sets a minimum line height on the selected paragraphs. Taller lines keep their height.
Parameters
Section titled “Parameters”points
Section titled “points”The minimum line height in points. Must be greater than 0.
Returns
Section titled “Returns”layout.line-spacing-exactly()
Section titled “layout.line-spacing-exactly()”layout.line-spacing-exactly(
points):ActionCall
Sets a fixed line height on the selected paragraphs.
Parameters
Section titled “Parameters”points
Section titled “points”The line height in points. Must be greater than 0.
Returns
Section titled “Returns”layout.line-spacing-multiple()
Section titled “layout.line-spacing-multiple()”layout.line-spacing-multiple(
factor):ActionCall
Sets the line spacing of the selected paragraphs as a multiple of single spacing.
Parameters
Section titled “Parameters”factor
Section titled “factor”The multiple of single spacing, such as 1.15. Must be greater than 0.
Returns
Section titled “Returns”layout.space-before()
Section titled “layout.space-before()”layout.space-before(
points):ActionCall
Sets the space above the selected paragraphs.
Parameters
Section titled “Parameters”points
Section titled “points”The space in points. Must be 0 or more.
Returns
Section titled “Returns”layout.space-after()
Section titled “layout.space-after()”layout.space-after(
points):ActionCall
Sets the space below the selected paragraphs.
Parameters
Section titled “Parameters”points
Section titled “points”The space in points. Must be 0 or more.
Returns
Section titled “Returns”layout.contextual-spacing()
Section titled “layout.contextual-spacing()”layout.contextual-spacing(
value?):ActionCall
Leaves out the space between the selected paragraphs and adjacent paragraphs of the same style, or adds it back.
Parameters
Section titled “Parameters”value?
Section titled “value?”true to leave the space out, false to add it back. Omit to toggle it.
Returns
Section titled “Returns”layout.page-size()
Section titled “layout.page-size()”layout.page-size(
size):ActionCall
Sets the page size of the current section.
Parameters
Section titled “Parameters”The paper size.
"Letter" | "A4" | "A5" | "A6"
Returns
Section titled “Returns”layout.page-orientation()
Section titled “layout.page-orientation()”layout.page-orientation(
orientation):ActionCall
Sets the page orientation of the current section.
Parameters
Section titled “Parameters”orientation
Section titled “orientation”The page orientation.
"portrait" | "landscape"
Returns
Section titled “Returns”layout.page-margin()
Section titled “layout.page-margin()”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.
Parameters
Section titled “Parameters”The page edge.
points
Section titled “points”Distance from the edge, in points. Must be 0 or more.
Returns
Section titled “Returns”layout.header-footer-different-first()
Section titled “layout.header-footer-different-first()”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.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”true to give the first page its own header and footer, false to stop.
Returns
Section titled “Returns”layout.header-footer-different-odd-even()
Section titled “layout.header-footer-different-odd-even()”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.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”true to use different headers and footers, false to stop.
Returns
Section titled “Returns”layout.header-footer-distance()
Section titled “layout.header-footer-distance()”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.
Parameters
Section titled “Parameters”'header' for the distance from the top edge to the header, 'footer' for the
distance from the bottom edge to the footer.
"header" | "footer"
points
Section titled “points”The distance in points. Must be 0 or more.
Returns
Section titled “Returns”layout.default-tab-stop()
Section titled “layout.default-tab-stop()”layout.default-tab-stop(
points):ActionCall
Sets the document’s default tab stop interval. Backs the ruler’s default spacing popover.
Parameters
Section titled “Parameters”points
Section titled “points”The interval in points. Must be greater than 0.
Returns
Section titled “Returns”style.apply()
Section titled “style.apply()”style.apply(
styleId):ActionCall
Applies a paragraph style to the selected paragraphs.
Parameters
Section titled “Parameters”styleId
Section titled “styleId”The ID of a style in the document, such as 'Heading 1'.
Returns
Section titled “Returns”style.apply-clear()
Section titled “style.apply-clear()”style.apply-clear(
styleId):ActionCall
Applies a paragraph style to the selected paragraphs and removes the formatting set directly on them.
Parameters
Section titled “Parameters”styleId
Section titled “styleId”The ID of a style in the document, such as 'Heading 1'.
Returns
Section titled “Returns”style.update()
Section titled “style.update()”style.update(
styleId):ActionCall
Changes a style to match the formatting of the selection.
Parameters
Section titled “Parameters”styleId
Section titled “styleId”The ID of a style in the document, such as 'Heading 1'.
Returns
Section titled “Returns”shape.set-type()
Section titled “shape.set-type()”shape.set-type(
preset):ActionCall
Changes the shape type of the selected shape.
Parameters
Section titled “Parameters”preset
Section titled “preset”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.
Returns
Section titled “Returns”shape.set-fill-color()
Section titled “shape.set-fill-color()”shape.set-fill-color(
color):ActionCall
Sets the fill color of the selected shape. The fill keeps its transparency.
Parameters
Section titled “Parameters”A hex color, or null to remove the fill.
Returns
Section titled “Returns”shape.set-fill-transparency()
Section titled “shape.set-fill-transparency()”shape.set-fill-transparency(
percent):ActionCall
Sets the transparency of the selected shape’s fill. Runs when the shape has a fill color.
Parameters
Section titled “Parameters”percent
Section titled “percent”From 0 (opaque) to 100 (fully transparent).
Returns
Section titled “Returns”shape.set-outline-color()
Section titled “shape.set-outline-color()”shape.set-outline-color(
color):ActionCall
Sets the outline color of the selected shape.
Parameters
Section titled “Parameters”A hex color, or null to remove the outline.
Returns
Section titled “Returns”shape.set-outline-width()
Section titled “shape.set-outline-width()”shape.set-outline-width(
points):ActionCall
Sets the outline width of the selected shape.
Parameters
Section titled “Parameters”points
Section titled “points”The width in points. Must be 0 or more. 0 removes the outline.
Returns
Section titled “Returns”shape.set-outline-transparency()
Section titled “shape.set-outline-transparency()”shape.set-outline-transparency(
percent):ActionCall
Sets the transparency of the selected shape’s outline. Runs when the outline has a color.
Parameters
Section titled “Parameters”percent
Section titled “percent”From 0 (opaque) to 100 (fully transparent).
Returns
Section titled “Returns”shape.set-text-padding()
Section titled “shape.set-text-padding()”shape.set-text-padding(
side,value,unit):ActionCall
Sets the space between one edge of the selected shape and its text.
Parameters
Section titled “Parameters”The edge of the shape.
The space, in unit. Must be 0 or more.
The unit of value.
Returns
Section titled “Returns”shape.set-wrapping()
Section titled “shape.set-wrapping()”shape.set-wrapping(
mode):ActionCall
Sets how the selected shape sits in the text.
Parameters
Section titled “Parameters”'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"
Returns
Section titled “Returns”object.set-wrapping()
Section titled “object.set-wrapping()”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.
Parameters
Section titled “Parameters”'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"
offset?
Section titled “offset?”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.
Returns
Section titled “Returns”object.arrange()
Section titled “object.arrange()”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.
Parameters
Section titled “Parameters”'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"
Returns
Section titled “Returns”field.update()
Section titled “field.update()”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.
Returns
Section titled “Returns”field.change()
Section titled “field.change()”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.
Parameters
Section titled “Parameters”'pageNum' for the current page number or 'pageCount' for the number of pages.
"pageNum" | "pageCount"
Returns
Section titled “Returns”spellcheck.replace()
Section titled “spellcheck.replace()”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.
Parameters
Section titled “Parameters”clusterBegin
Section titled “clusterBegin”Where the word starts, as a character cluster index in the paragraph. A whole number, 0 or more.
clusterEnd
Section titled “clusterEnd”Where the word ends, as a character cluster index in the paragraph. A whole number, 0 or more.
replacement
Section titled “replacement”The text to put in place of the word. Must not be empty.
Returns
Section titled “Returns”paragraph.set-shading()
Section titled “paragraph.set-shading()”paragraph.set-shading(
color):ActionCall
Sets the background color of the selected paragraphs.
Parameters
Section titled “Parameters”A hex color. 'none' or null removes the background.
Returns
Section titled “Returns”paragraph.set-border-color()
Section titled “paragraph.set-border-color()”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.
Parameters
Section titled “Parameters”The border to change.
A hex color, or null to remove the border. With 'none', the border keeps its
width but has no color.
Returns
Section titled “Returns”paragraph.set-border-width()
Section titled “paragraph.set-border-width()”paragraph.set-border-width(
side,points):ActionCall
Sets the width of one border of the selected paragraphs.
Parameters
Section titled “Parameters”The border to change.
points
Section titled “points”The width in points. Must be 0 or more.
Returns
Section titled “Returns”paragraph.set-border-radius()
Section titled “paragraph.set-border-radius()”paragraph.set-border-radius(
corners,points):ActionCall
Rounds the corners of the border around the selected paragraphs.
Parameters
Section titled “Parameters”corners
Section titled “corners”'Outer' for the outer corners of the border, 'Inner' for the corners where
consecutive bordered paragraphs meet.
"Outer" | "Inner"
points
Section titled “points”The corner radius in points. Must be 0 or more.
Returns
Section titled “Returns”paragraph.set-indent()
Section titled “paragraph.set-indent()”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.
Parameters
Section titled “Parameters”The indent to set.
"left" | "right" | "first-line"
points
Section titled “points”The position in points from the left margin, or from the right margin for the right indent. Negative positions are allowed.
Returns
Section titled “Returns”paragraph.change-tab-stops()
Section titled “paragraph.change-tab-stops()”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.
Parameters
Section titled “Parameters”changes
Section titled “changes”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.