> ## 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.

# Comments and revisions

Guides: [Redlining](https://docs.reducto.ai/office/docx/recipes/redlining.md), [Comments](https://docs.reducto.ai/office/docx/recipes/comments.md), [Compare documents](https://docs.reducto.ai/office/docx/recipes/compare.md).

## `Comment`

Not exported by name. You get it from the API.

### Comment properties

| Name | Type | Description |
| - | - | - |
| `authorEmail` | `string` | read-only |
| `authorName` | `string` | |
| `content` | `string` | |
| `contentRange` | `CommentContentRange` | read-only |
| `creationDate` | `Date` | read-only |
| `id` | `string` | read-only |
| `replies` | `CommentReplyCollection` | read-only |
| `resolved` | `boolean` | |

### `Comment.delete()`

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

### `Comment.getRange()`

```ts theme={null}
getRange(): Range
```

### `Comment.reply()`

```ts theme={null}
reply(text: string): CommentReply
```

### `Comment.set()`

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

## `CommentReply`

Not exported by name. You get it from the API.

### CommentReply properties

| Name | Type | Description |
| - | - | - |
| `authorEmail` | `string` | read-only |
| `authorName` | `string` | |
| `content` | `string` | |
| `contentRange` | `CommentContentRange` | read-only |
| `creationDate` | `Date` | read-only |
| `id` | `string` | read-only |
| `parentComment` | `Comment` | read-only |

### `CommentReply.delete()`

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

### `CommentReply.set()`

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

## `Revision`

Not exported by name. You get it from the API.

### Revision properties

| Name | Type | Description |
| - | - | - |
| `author` | `string` | read-only |
| `date` | `string` | read-only The `w:date` stamp as an ISO 8601 STRING, the OfficeJS spelling. It is READ-ONLY: who is speaking is authorable through Document.revisionAuthor, when they spoke stays the machine clock. |
| `formatDescription` | `string` | read-only |
| `index` | `number` | read-only |
| `movedRange` | `Range` | read-only |
| `range` | `Range` | read-only |
| `revisionIds` | `number[]` | read-only Extension: the `w:id` of each revision mark this change joins. They stay as written in the saved file until Word saves it again, so they name an edit. |
| `storyType` | `RevisionStoryType` | read-only Which loaded story holds this revision; the vocabulary Body.type speaks. |
| `text` | `string` | read-only Word reads a run of adjacent same-author changes as one, paragraph marks included. |
| `type` | `RevisionType` | read-only |

### `Revision.accept()`

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

### `Revision.getNext()`

```ts theme={null}
getNext(): Revision
```

### `Revision.getNextOrNullObject()`

```ts theme={null}
getNextOrNullObject(): Revision & { isNullObject: true } | Revision & { isNullObject: false }
```

### `Revision.getRange()`

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

The text this revision covers. A body DELETION reads the struck text: the
paragraph's own offsets are the final view and skip `w:delText`, so the
range is addressed by the `w:del` element instead — which is also what lets
a comment anchor around it. An INSERTION another author has since struck
carries the same problem inside itself, so it is addressed by its `w:ins`
the same way: the range stays over the insertion's own words instead of
sliding onto the runs after it. Revisions in other stories refuse by
naming their story: a header or note handle owns those ranges.

### `Revision.reject()`

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

### `Revision.set()`

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

## `TrackedChange`

Not exported by name. You get it from the API.

### TrackedChange properties

| Name | Type | Description |
| - | - | - |
| `author` | `string` | read-only |
| `date` | `Date` | read-only OfficeJS spells a TrackedChange date as a Date; Revision.date is the ISO string. |
| `revisionIds` | `number[]` | read-only Extension: the `w:id` of each revision mark this change joins. They stay as written in the saved file until Word saves it again, so they name an edit. |
| `text` | `string` | read-only Word reads a run of adjacent same-author changes as one, paragraph marks included. |
| `type` | `RevisionType \| TrackedChangeType` | read-only |

### `TrackedChange.accept()`

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

### `TrackedChange.getNext()`

```ts theme={null}
getNext(): TrackedChange
```

### `TrackedChange.getNextOrNullObject()`

```ts theme={null}
getNextOrNullObject(): TrackedChange & { isNullObject: true } | TrackedChange & { isNullObject: false }
```

### `TrackedChange.getRange()`

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

The text this revision covers. A body DELETION reads the struck text: the
paragraph's own offsets are the final view and skip `w:delText`, so the
range is addressed by the `w:del` element instead — which is also what lets
a comment anchor around it. An INSERTION another author has since struck
carries the same problem inside itself, so it is addressed by its `w:ins`
the same way: the range stays over the insertion's own words instead of
sliding onto the runs after it. Revisions in other stories refuse by
naming their story: a header or note handle owns those ranges.

### `TrackedChange.reject()`

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

## `compareDocuments()`

```ts theme={null}
function compareDocuments(
  original: Uint8Array,
  revised: Uint8Array,
  options?: CompareOptions,
): Promise<Uint8Array<ArrayBufferLike>>
```

Word's Compare: `revised` with every difference from `original` written in as
tracked changes, so Accept All gives `revised` and Reject All `original`.
Pending revisions on either side are accepted first, as Word does.

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

## `CompareOptions`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`, `@reductoai/docx/node`, `@reductoai/docx/officejs`.

| Name | Type | Description |
| - | - | - |
| `author?` | `string` | Author of every revision the compare writes. |
| `date?` | `Date` | |
| `formatting?` | `boolean` | Track format changes on kept content (Word's "Formatting" compare setting); default true. Off, compareDocuments gives kept text the original's formatting, combineDocuments the revised copy's. |
| `originalRevisions?` | `"keep" \| "settle" \| "reverse"` | combineDocuments only. "keep" (default, Word's Combine): every pending revision of `original` stays, by its own author, also where `revised` accepted or rejected it or never had it, so a second reviewer's copy combined into the first result keeps both. "settle": `revised` settles them, so the result holds only `revised`'s own revisions and the newly marked differences. "reverse": as "settle", but every pending revision of `original` that `revised` no longer has counts as accepted, so one it rejected comes back as the label's opposite edit. With "settle" and "reverse", Accept All shows the revised copy on every page, headers and footers included, and Reject All gives the original's text, for every `formatting` and `whitespace` value. |
| `pendingEdits?` | `"ignore" \| "deletions" \| "all"` | combineDocuments only. Untracked edits inside an insertion both copies still hold pending: "ignore" (default, as Word's Combine) leaves them unmarked; "deletions" marks deleted text as the label's deletion inside that insertion; "all" also marks added text, which splits the insertion, so rejecting its author keeps the label's text. |
| `whitespace?` | `boolean` | Mark differences made only of spaces, tabs, line breaks and paragraph marks (section breaks too); default true. Off, they stay unmarked: compareDocuments and combineDocuments with "settle" or "reverse" keep the revised copy's, so Reject All keeps them; combineDocuments "keep" keeps the original's, as Word's Combine does. |
