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

# Other classes: Content controls

## `CheckboxContentControl`

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

### CheckboxContentControl properties

| Name | Type | Description |
| - | - | - |
| `checkedState` | `{ character: string; font: string }` | read-only |
| `isChecked` | `boolean` | |
| `uncheckedState` | `{ character: string; font: string }` | read-only |

### `CheckboxContentControl.set()`

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

## `ContentControlCollection`

OfficeJS-flavored live collection: `items` is recomputed on every access.

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

### ContentControlCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `T[]` | read-only |
| `length` | `number` | read-only |

### `ContentControlCollection.at()`

```ts theme={null}
at(index: number): ContentControl
```

### `ContentControlCollection.getByChangeTrackingStates()`

```ts theme={null}
getByChangeTrackingStates(
  states: ("Unknown" | "Normal" | "Added" | "Deleted")[],
): ContentControlCollection
```

### `ContentControlCollection.getById()`

```ts theme={null}
getById(id: number): ContentControl
```

### `ContentControlCollection.getByIdOrNullObject()`

```ts theme={null}
getByIdOrNullObject(id: number): ContentControl
```

### `ContentControlCollection.getByTag()`

```ts theme={null}
getByTag(tag: string): ContentControlCollection
```

### `ContentControlCollection.getByTitle()`

```ts theme={null}
getByTitle(title: string): ContentControlCollection
```

### `ContentControlCollection.getByTypes()`

```ts theme={null}
getByTypes(types: ContentControlType[]): ContentControlCollection
```

### `ContentControlCollection.getFirst()`

```ts theme={null}
getFirst(): ContentControl
```

### `ContentControlCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): ContentControl & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `ContentControlCollection.getItem()`

```ts theme={null}
getItem(id: number): ContentControl
```

OfficeJS spelling of at().

### `ContentControlCollection.getLast()`

```ts theme={null}
getLast(): ContentControl
```

### `ContentControlCollection.getLastOrNullObject()`

```ts theme={null}
getLastOrNullObject(): ContentControl & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

## `ContentControlListItem`

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

### ContentControlListItem properties

| Name | Type | Description |
| - | - | - |
| `displayText` | `string` | |
| `index` | `number` | |
| `value` | `string` | |

### `ContentControlListItem.delete()`

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

### `ContentControlListItem.select()`

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

### `ContentControlListItem.set()`

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

## `ContentControlsModel`

Not exported by name. You get it from the API. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### ContentControlsModel properties

| Name | Type | Description |
| - | - | - |
| `showAll` | `boolean` | |
| `version` | `number` | Bumps on every change of this object or an adopted child. |

### `ContentControlsModel.clearHover()`

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

### `ContentControlsModel.clickAt()`

```ts theme={null}
clickAt(page: number, xHmm: number, yHmm: number, at: ClientPoint): boolean
```

A click on a check box glyph flips it, as in Word, and the caret stays
where it was; a click on a dropdown opens its list.

### `ContentControlsModel.holdsCaret()`

```ts theme={null}
holdsCaret(): boolean
```

The caret sits in a control, which may refuse or reshape what is typed.

### `ContentControlsModel.hoverAt()`

```ts theme={null}
hoverAt(page: number, xHmm: number, yHmm: number): void
```

Track the control under the pointer; the frame repaints only when it changes.

### `ContentControlsModel.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `ContentControlsModel.openDatePicker()`

```ts theme={null}
openDatePicker(
  control: ContentControlInfo,
  at: ClientPoint,
  align?: "start" | "end",
): void
```

Word's calendar under a date picker, hung from a viewport point by its left or right edge.

### `ContentControlsModel.openPicker()`

```ts theme={null}
openPicker(control: ContentControlInfo, at: ClientPoint): void
```

Word's list flyout under a dropdown: the caret enters the control, then the items show.

### `ContentControlsModel.paint()`

```ts theme={null}
paint(pxPerHmm: number): void
```

The overlay pass: every control when showing all, the caret's control on top.

### `ContentControlsModel.pickerItems()`

```ts theme={null}
pickerItems(control: ContentControlInfo): MenuItem[]
```

The item rows of a list control; the shown item is ticked.

### `ContentControlsModel.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `ContentControlsModel.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

### `ContentControlsModel.toggle()`

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

## `CustomXmlPart`

Import from `@reductoai/docx/officejs`.

### CustomXmlPart properties

| Name | Type | Description |
| - | - | - |
| `builtIn` | `boolean` | read-only |
| `id` | `string` | read-only The `ds:itemID` of the part, braces included. |
| `namespaceUri` | `string` | read-only |
| `xml` | `string` | read-only |

### `CustomXmlPart.delete()`

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

### `CustomXmlPart.deleteAttribute()`

```ts theme={null}
deleteAttribute(xpath: string, namespaceMappings: NamespaceMappings, name: string): void
```

### `CustomXmlPart.deleteElement()`

```ts theme={null}
deleteElement(xpath: string, namespaceMappings: NamespaceMappings): void
```

### `CustomXmlPart.getXml()`

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

### `CustomXmlPart.insertAttribute()`

```ts theme={null}
insertAttribute(
  xpath: string,
  namespaceMappings: NamespaceMappings,
  name: string,
  value: string,
): void
```

### `CustomXmlPart.insertElement()`

```ts theme={null}
insertElement(
  xpath: string,
  xml: string,
  namespaceMappings: NamespaceMappings,
  index?: number,
): void
```

Insert the XML as children of each matched element, at `index` or last.

### `CustomXmlPart.loadXml()`

```ts theme={null}
loadXml(xml: string): ClientResult<boolean>
```

### `CustomXmlPart.query()`

```ts theme={null}
query(xpath: string, namespaceMappings?: NamespaceMappings): ClientResult<string[]>
```

Each match as XML: an element's markup, an attribute's value.

### `CustomXmlPart.setXml()`

```ts theme={null}
setXml(xml: string): void
```

Replace the whole document; the part keeps its id and its bindings.

### `CustomXmlPart.updateAttribute()`

```ts theme={null}
updateAttribute(
  xpath: string,
  namespaceMappings: NamespaceMappings,
  name: string,
  value: string,
): void
```

Sets an attribute the element already carries; a missing one throws, as in Word.

### `CustomXmlPart.updateElement()`

```ts theme={null}
updateElement(xpath: string, xml: string, namespaceMappings: NamespaceMappings): void
```

**Not implemented.** These Office.js members throw: `documentElement`, `namespaceManager`, `schemaCollection`, `addNode`, `selectNodes`, `selectSingleNode`.

## `CustomXmlPartCollection`

OfficeJS-flavored live collection: `items` is recomputed on every access.

Import from `@reductoai/docx/officejs`.

### CustomXmlPartCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `T[]` | read-only |
| `length` | `number` | read-only |

### `CustomXmlPartCollection.add()`

```ts theme={null}
add(xml: string): CustomXmlPart
```

### `CustomXmlPartCollection.at()`

```ts theme={null}
at(index: number): CustomXmlPart
```

### `CustomXmlPartCollection.getByNamespace()`

```ts theme={null}
getByNamespace(namespaceUri: string): CustomXmlPartScopedCollection
```

### `CustomXmlPartCollection.getCount()`

```ts theme={null}
getCount(): ClientResult<number>
```

### `CustomXmlPartCollection.getFirst()`

```ts theme={null}
getFirst(): CustomXmlPart
```

### `CustomXmlPartCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): CustomXmlPart & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `CustomXmlPartCollection.getItem()`

```ts theme={null}
getItem(id: string | number): CustomXmlPart
```

Lookup by `ds:itemID`, with or without braces; a number is the shared signed index.

### `CustomXmlPartCollection.getItemOrNullObject()`

```ts theme={null}
getItemOrNullObject(id: string): CustomXmlPart & { isNullObject: boolean }
```

### `CustomXmlPartCollection.getLast()`

```ts theme={null}
getLast(): CustomXmlPart
```

### `CustomXmlPartCollection.getLastOrNullObject()`

```ts theme={null}
getLastOrNullObject(): CustomXmlPart & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

## `CustomXmlPartScopedCollection`

OfficeJS-flavored live collection: `items` is recomputed on every access.

Import from `@reductoai/docx/officejs`.

### CustomXmlPartScopedCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `T[]` | read-only |
| `length` | `number` | read-only |

### `CustomXmlPartScopedCollection.at()`

```ts theme={null}
at(index: number): CustomXmlPart
```

### `CustomXmlPartScopedCollection.getCount()`

```ts theme={null}
getCount(): ClientResult<number>
```

### `CustomXmlPartScopedCollection.getFirst()`

```ts theme={null}
getFirst(): CustomXmlPart
```

### `CustomXmlPartScopedCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): CustomXmlPart & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `CustomXmlPartScopedCollection.getItem()`

```ts theme={null}
getItem(id: string | number): CustomXmlPart
```

Lookup by `ds:itemID`, with or without braces; a number is the shared signed index.

### `CustomXmlPartScopedCollection.getItemOrNullObject()`

```ts theme={null}
getItemOrNullObject(id: string): CustomXmlPart & { isNullObject: boolean }
```

### `CustomXmlPartScopedCollection.getLast()`

```ts theme={null}
getLast(): CustomXmlPart
```

### `CustomXmlPartScopedCollection.getLastOrNullObject()`

```ts theme={null}
getLastOrNullObject(): CustomXmlPart & { isNullObject: boolean }
```

OfficeJS null-object variant; inspect `isNullObject` before other members.

### `CustomXmlPartScopedCollection.getOnlyItem()`

```ts theme={null}
getOnlyItem(): CustomXmlPart
```

### `CustomXmlPartScopedCollection.getOnlyItemOrNullObject()`

```ts theme={null}
getOnlyItemOrNullObject(): CustomXmlPart & { isNullObject: boolean }
```

## `DatePickerContentControl`

Import from `@reductoai/docx/officejs`.

### DatePickerContentControl properties

| Name | Type | Description |
| - | - | - |
| `control` | `TextControl` | read-only |
| `dateDisplayFormat` | `string` | `w:dateFormat`, Word's date picture; the en-US default when the part names none. |
| `dateDisplayLocale` | `string \| undefined` | read-only `w:lid`: the language of the month and weekday names. |
| `fullDate` | `Date \| undefined` | read-only The picked day (`w:fullDate`) at local midnight; undefined until a pick. |

### `DatePickerContentControl.formatDate()`

```ts theme={null}
formatDate(day: Date): string
```

The day as the picture shows it.

### `DatePickerContentControl.selectDate()`

```ts theme={null}
selectDate(day: Date): void
```

The calendar's pick: the text shows the day through the picture and `w:fullDate` stores it.

### `DatePickerContentControl.set()`

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

## `ListContentControl`

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

### ListContentControl properties

| Name | Type | Description |
| - | - | - |
| `control` | `TextControl` | read-only |
| `listItems` | `HandleCollection<ContentControlListItem>` | read-only |

### `ListContentControl.addListItem()`

```ts theme={null}
addListItem(displayText: string, value?: string, index?: number): ContentControlListItem
```

### `ListContentControl.changed()`

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

### `ListContentControl.deleteAllListItems()`

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

## `XmlMapping`

Import from `@reductoai/docx/officejs`.

### XmlMapping properties

| Name | Type | Description |
| - | - | - |
| `customXmlPart` | `CustomXmlPart & { isNullObject: boolean }` | read-only The part the mapping reads; a null object when unmapped or the part is gone. |
| `isMapped` | `boolean` | read-only |
| `prefixMappings` | `string` | read-only |
| `xpath` | `string` | read-only |

### `XmlMapping.delete()`

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

Unmap the control; its content stays as it is.

### `XmlMapping.setMapping()`

```ts theme={null}
setMapping(xPath: string, options?: XmlSetMappingOptions): ClientResult<boolean>
```

Map the control to the node `xPath` selects and show its value. False, and no mapping,
when no part has such a node or the node holds elements rather than a value.

**Not implemented.** These Office.js members throw: `customXmlNode`, `setMappingByNode`.
