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

# Body

## `Body`

Block-level content in address order: the document body, one table cell, or
one textbox story.

Import from `@reductoai/docx/node`, `@reductoai/docx/officejs`.

### Body properties

| Name | Type | Description |
| - | - | - |
| `charts` | `HandleCollection<Chart>` | read-only Chart frames anywhere in this body's story (extension; OfficeJS has no chart API). |
| `contentControls` | `ContentControlCollection` | read-only |
| `endnotes` | `HandleCollection<NoteItem>` | read-only Endnotes referenced from this scope, in story order (stubs excluded). |
| `equations` | `HandleCollection<Equation>` | read-only Extension: every equation in the story, read and rewritten as TeX. |
| `fields` | `FieldCollection` | read-only Fields in scope (both syntaxes, nested and cross-paragraph); read-only. |
| `font` | `Font` | read-only Run formatting over every paragraph in scope. |
| `footnotes` | `HandleCollection<NoteItem>` | read-only Footnotes referenced from this scope, in story order (stubs excluded). |
| `inlinePictures` | `HandleCollection<InlinePicture>` | read-only |
| `lists` | `HandleCollection<List>` | read-only |
| `paragraphs` | `ParagraphCollection<Paragraph>` | read-only |
| `parentBodyOrNullObject` | `object & { isNullObject: true }` | read-only |
| `parentContentControlOrNullObject` | `object & { isNullObject: true }` | read-only |
| `parentSection` | `Section` | read-only |
| `parentSectionOrNullObject` | `Section & { isNullObject: false }` | read-only |
| `sections` | `SectionCollection<Section>` | read-only Extension (Word has Range.sections): the document's sections; a cell or textbox gives its own. |
| `shapes` | `HandleCollection<Shape>` | read-only Floating textboxes and pictures anchored anywhere in this body's story. |
| `style` | `string` | The style every paragraph shares, or "" when they differ. |
| `styleBuiltIn` | `string` | The built-in name every paragraph shares, or "Other" when they differ. |
| `tables` | `TableCollection<Table>` | read-only |
| `text` | `string` | read-only All text in scope in document order, paragraphs joined by "\n". |
| `type` | `"MainDoc" \| "TableCell" \| "TextBox"` | read-only |

### `clear()`

```ts theme={null}
clear(): void
```

Remove all content in scope, leaving a single empty paragraph.

### `getComments()`

```ts theme={null}
getComments(): CommentCollection
```

### `getContentControls()`

```ts theme={null}
getContentControls(options?: ContentControlOptions): ContentControlCollection
```

### `getHtml()`

```ts theme={null}
getHtml(): ClientResult<string>
```

As Word: tables as `<table>` (merges as colspan/rowspan), `<h1>-<h6>` for headings,
list markers as text, b/i/u/s/sup/sub and links inline.

### `getOoxml()`

```ts theme={null}
getOoxml(): ClientResult<string>
```

### `getRange()`

```ts theme={null}
getRange(location?: "Start" | "End" | "Whole" | "Content"): Range
```

"Whole" and "Content" span the first paragraph's start to the last one's end; "Start"/"End" are collapsed.

### `getReviewedText()`

```ts theme={null}
getReviewedText(changeTrackingVersion?: "Original" | "Current"): ClientResult<string>
```

### `getTrackedChanges()`

```ts theme={null}
getTrackedChanges(): TrackedChangeCollection
```

Word lists a story's own changes: the main body's leave out headers, footers and notes.

### `insertChart()`

```ts theme={null}
insertChart(spec: ChartCreateSpec, insertLocation?: BodyInsertLocation): Chart
```

Insert an inline chart (extension); data comes from the spec's literal caches.

### `insertContentControl()`

```ts theme={null}
insertContentControl(type?: ContentControlType): ContentControl
```

### `insertDiagram()`

```ts theme={null}
insertDiagram(spec: DiagramCreateSpec, insertLocation?: BodyInsertLocation): Diagram
```

Insert an inline SmartArt diagram (extension); the frame is painted from a cache.

### `insertFileFromBase64()`

```ts theme={null}
insertFileFromBase64(
  base64File: DocxFile,
  insertLocation?: "Replace" | "Start" | "End",
): Promise<Range>
```

Insert a .docx's body at the edge (or in place of the content), with its images, links, styles,
numbering, notes and comments. Async here: unlike Word, the file is unpacked on this side.

### `insertHtml()`

```ts theme={null}
insertHtml(html: string, insertLocation?: BodyInsertLocation): Range
```

Insert a strict named subset of HTML at the story boundary; any tag
outside the subset throws, listing every offender.

### `insertInlinePictureFromBase64()`

```ts theme={null}
insertInlinePictureFromBase64(
  base64: string,
  insertLocation: BodyInsertLocation,
  options?: InsertInlinePictureOptions,
): InlinePicture
```

### `insertMath()`

```ts theme={null}
insertMath(...__namedParameters: InsertMathArgs<BodyInsertLocation>): Range
```

Extension: TeX math as a native Office Math equation in a new paragraph at the story edge.

### `insertOoxml()`

```ts theme={null}
insertOoxml(ooxml: string, insertLocation?: BodyInsertLocation): Range
```

### `insertParagraph()`

```ts theme={null}
insertParagraph(
  text: string,
  location?: BodyInsertLocation,
  options?: Omit<OfficeRunFormat<InsertParagraphOptions>, "text">,
): Paragraph
```

Insert a paragraph at the start or end of the scope, as Office.js does:
Start splits the first paragraph before its text, End types a new
paragraph after the last one. Both keep the edge paragraph's style,
numbering and paragraph formatting. When the body's last paragraph is
empty (a new document's, or the one Word keeps after a final table), End
lands before it and that empty paragraph stays last, as in Word. In a
table cell, End types the text at the end of the cell's last paragraph and
puts an empty paragraph after it, as Word does.

### `insertTable()`

```ts theme={null}
insertTable(
  rowCount: number,
  columnCount: number,
  location?: BodyInsertLocation,
  values?: string[][],
  options?: Omit<OfficeRunFormat<InsertTableOptions>, "rows">,
): Table
```

Insert a table at the start or end of the body; `values` fills cells
row-major. Cells are born plain — the table style owns their appearance.

### `insertText()`

```ts theme={null}
insertText(
  text: string,
  location?: "Replace" | "Start" | "End",
  format?: OfficeRunFormatInput,
): Range
```

Insert into the scope's text: "Start"/"End" edit the first/last paragraph;
"Replace" clears the scope and leaves the text in one paragraph.

### `search()`

```ts theme={null}
search(needle: string, options?: SearchOptions): RangeCollection<Range>
```

Literal search across the scope, table cells included. Returns a plain
snapshot array by design: collections are live queries, but a search hit
is a point-in-time span that re-anchors (or goes stale) on its own terms.

### `set()`

```ts theme={null}
set(properties: BodyUpdateData, options?: UpdateOptions): void
```

**Not implemented.** These Office.js members throw: `parentBody`, `parentContentControl`, `insertBreak`, `select`.
