> ## Documentation Index
> Fetch the complete documentation index at: https://developers.myhero.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Docx format

> Change text and paragraph formatting. To format multiple items at once, use docx_mutations with format.apply steps instead of calling this tool…

`docx_format`

Change text and paragraph formatting. To format multiple items at once, use docx\_mutations with format.apply steps instead of calling this tool repeatedly. Use require "all" with a node selector to format every heading or paragraph in one batch. Use this tool for single-item formatting when you have a valid ref or nodeId. Action "inline" applies character formatting (bold, italic, underline, color, fontSize, fontFamily, highlight, strike, vertAlign) to a text range via "ref". Action "set\_style" applies a named paragraph style by styleId (get available styles from docx\_get\_content info). Actions "set\_alignment", "set\_indentation", "set\_spacing", "set\_direction", and "set\_flow\_options" change paragraph-level properties and require a block target: \{kind:"block", nodeType:"paragraph", nodeId:"\<nodeId>"}, NOT a ref. Use "set\_flow\_options" with pageBreakBefore:true to start a paragraph on a new page. Supports "dryRun" and "changeMode: tracked" for inline formatting. Paragraph-level actions do NOT support tracked changes. Do NOT use a search ref for paragraph-level actions; they require a block target with nodeId. Do NOT use \{kind:"block", start:\{kind:"nodeEdge",...}} or selection-like structures for paragraph actions. ONLY \{kind:"block", nodeType, nodeId} is accepted. Do NOT issue multiple docx\_format calls in parallel; each call invalidates refs for subsequent calls.

## Parameters

**action** `string, enum: 'inline' | 'set_alignment' | 'set_direction' | 'set_flow_options' | 'set_indentation' | 'set_spacing' | 'set_style'` *required*

The action to perform. One of: inline, set\_alignment, set\_direction, set\_flow\_options, set\_indentation, set\_spacing, set\_style.

**force** `boolean`

Bypass confirmation checks.

**changeMode** `string, enum: 'direct' | 'tracked'`

Edit mode: "direct" applies changes immediately, "tracked" records as suggestions.

**dryRun** `boolean`

Preview the result without applying changes.

**target** `object`

Selection target: \{kind:'selection', start:\{kind:'text', blockId, offset}, end:\{kind:'text', blockId, offset}}. Use 'ref' instead when you have a search result handle. Required for actions 'set\_style', 'set\_alignment', 'set\_indentation', 'set\_spacing', 'set\_flow\_options', 'set\_direction'.

**inline** `object`

Inline formatting properties to apply. Set a property to apply it, use null to clear it. Example: \{bold: true, italic: true} or \{bold: null} to remove bold. Only for action 'inline'. Omit for other actions.

**ref** `string`

Handle ref string from a docx\_search result. Pass the handle.ref value directly (e.g. 'text:eyJ...'). Preferred over 'target' for inline formatting. Only for action 'inline'. Omit for other actions.

**styleId** `string`

Named paragraph style ID (e.g. 'Normal', 'Heading1', 'BodyText'). Use docx\_search to find a nearby paragraph, then inspect its style to determine the correct styleId. Required for action 'set\_style'.

**alignment** `string, enum: 'left' | 'center' | 'right' | 'justify'`

Required for action 'set\_alignment'.

**left** `number`

Left indentation in twips (1440 = 1 inch). Only for action 'set\_indentation'. Omit for other actions.

**right** `number`

Right indentation in twips (1440 = 1 inch). Only for action 'set\_indentation'. Omit for other actions.

**firstLine** `number`

First line indent in twips. Cannot be combined with hanging. Only for action 'set\_indentation'. Omit for other actions.

**hanging** `number`

Hanging indent in twips. Cannot be combined with firstLine. Only for action 'set\_indentation'. Omit for other actions.

**before** `number`

Space before paragraph in twips (20 twips = 1pt). Only for action 'set\_spacing'. Omit for other actions.

**after** `number`

Space after paragraph in twips (20 twips = 1pt). Only for action 'set\_spacing'. Omit for other actions.

**line** `number`

Line spacing value. Meaning depends on lineRule. Must be provided together with lineRule. Only for action 'set\_spacing'. Omit for other actions.

**lineRule** `string, enum: 'auto' | 'exact' | 'atLeast'`

Line spacing rule. Required when 'line' is set. Only for action 'set\_spacing'. Omit for other actions.

**contextualSpacing** `boolean`

Only for action 'set\_flow\_options'. Omit for other actions.

**pageBreakBefore** `boolean`

Only for action 'set\_flow\_options'. Omit for other actions.

**suppressAutoHyphens** `boolean`

Only for action 'set\_flow\_options'. Omit for other actions.

**direction** `string, enum: 'ltr' | 'rtl'`

Required for action 'set\_direction'.

**alignmentPolicy** `string, enum: 'preserve' | 'matchDirection'`

Only for action 'set\_direction'. Omit for other actions.

**documentId** `string` *required*

The HERO documentId of the docx to target.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.