Skip to content
ASTra

Operations

A batch is a list of operations. ASTra supports 27 kinds. Each has an action name, and many have an operation field that picks a variant, such as table with updateCell or deleteRow.

What an operation looks like

Operations are plain JSON. Content operations name a node with target (act on this node) or anchor (put something next to this node, with a position of before or after).

operations
[
  { "action": "replace", "target": "3FC95CAC", "text": "1. Executive Summary (Q4)" },
  { "action": "insert", "type": "paragraph", "anchor": "3FC95CAC", "position": "after", "text": "New paragraph." },
  { "action": "style", "target": "3FC95CAC", "bold": true },
  { "action": "table", "operation": "updateCell", "target": "<tableNodeId>", "rowIndex": 0, "columnIndex": 0, "text": "Cell" },
  { "action": "comment", "operation": "insert", "target": "3FC95CAC", "text": "Please review." },
  { "action": "delete", "target": "<nodeId>" }
]

Run astra batch --schema to print a canonical example of the most common operations. The full parameters of every variant are in the schema of the execute_batch tool.

All 27 operations

Content

insertAdd a paragraph, heading, table, image, chart, divider or page break before or after a node.
replaceReplace the text of a node while keeping its style.
deleteRemove a node.
moveMove a node to a new position.

Formatting

styleChange bold, italic, underline, colour, size and alignment of a node.
clearFormatRemove direct formatting so a node follows its style again.
namedStyleApply a named Word style such as Heading1 to a node.

Tables and page structure

tableEdit a table: cells, rows, columns, merging and splitting, borders, shading, widths, alignment and repeating header rows.
sectionSet the number of columns in a section, or split and merge sections.
pageSetupSet paper size, orientation, margins and columns.
pageBorderAdd a border around the page.
coverPageAdd a cover page.

Rich elements

chartInsert or update a native Word chart, for example column, line or combination charts.
imageInsert an image, resize it, and set its alt text.
equationInsert an equation as native Word math.
calloutInsert a highlighted note box.
fieldInsert a table of contents, page number or word count, or update fields.
listCreate a numbered or bulleted list, continue one, change a level, or remove list formatting.

References and annotations

footnoteAdd a footnote.
endnoteAdd an endnote.
hyperlinkAdd a link to a web address or a bookmark.
bookmarkAdd a bookmark.
commentAdd a comment, or reply to one.
headerFooterSet or remove header and footer content.
watermarkAdd a text watermark.

Revisions and properties

trackedChangeAccept or reject all tracked changes, or insert or delete text as a tracked change.
metadataSet document properties such as title, author, subject and keywords.

All or nothing. If any operation in a batch fails, none of the batch is applied. See Core concepts.