> ## 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: Text and formatting

## `Border`

One border location of a style or of a conditional block, live over its XML.

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

### Border properties

| Name | Type | Description |
| - | - | - |
| `color` | `string` | |
| `location` | `StyleBorderLocation` | read-only Readonly: a border addresses the location it was fetched by. |
| `type` | `BorderType` | |
| `visible` | `boolean` | |
| `width` | `number \| BorderWidth` | The BorderWidth token when `w:sz` matches one, otherwise the number of points (extension) — a size office.js cannot name is reported, not clamped. |

### `Border.set()`

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

## `BorderCollection`

The border locations one host carries, plus the office.js aggregates.

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

### BorderCollection properties

| Name | Type | Description |
| - | - | - |
| `insideBorderColor` | `string` | |
| `insideBorderType` | `BorderType` | |
| `insideBorderWidth` | `number \| BorderWidth` | |
| `items` | `Border[]` | read-only |
| `outsideBorderColor` | `string` | |
| `outsideBorderType` | `BorderType` | |
| `outsideBorderWidth` | `number \| BorderWidth` | |

### `BorderCollection.getByLocation()`

```ts theme={null}
getByLocation(location: StyleBorderLocation): Border
```

### `BorderCollection.getFirst()`

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

### `BorderCollection.getItem()`

```ts theme={null}
getItem(index: number): Border
```

## `BorderUniversal`

One border location of a paragraph, or of every paragraph a range covers.
Reads are effective and neutral on disagreement; writes are direct and reach
every covered paragraph. `artStyle`/`artWidth` refuse by name.

Import from `@reductoai/docx/officejs`.

### BorderUniversal properties

| Name | Type | Description |
| - | - | - |
| `color` | `string` | |
| `colorIndex` | `ColorIndexValue` | The ColorIndex naming this border's literal color; "Auto" when none does. |
| `inside` | `boolean` | read-only Readonly, as OfficeJS specifies: only the between border is an inside one. |
| `isVisible` | `boolean` | False writes an explicit `w:val="none"` rather than removing the side: the read is effective, so only an explicit none can hide a style's border. |
| `lineStyle` | `string` | A `w:val` this enum cannot name — "thick", or page-border art — reads "Single": there is a visible line, and no BorderLineStyle spells it. |
| `lineWidth` | `number \| BorderWidth` | The LineWidth token when `w:sz` names one, "None" when there is no line, otherwise the NUMBER of points (extension) — a stored weight the enum cannot name is reported, never rounded to a neighbour. |
| `location` | `ParagraphBorderLocation` | read-only Extension: which of the five locations this handle addresses. |

### `BorderUniversal.set()`

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

**Not implemented.** These Office.js members throw: `artStyle`, `artWidth`.

## `BorderUniversalCollection`

The five paragraph border locations, in VBA's WdBorderType order.

Import from `@reductoai/docx/officejs`.

### BorderUniversalCollection properties

| Name | Type | Description |
| - | - | - |
| `distanceFromBottom` | `number` | |
| `distanceFromLeft` | `number` | |
| `distanceFromRight` | `number` | |
| `distanceFromTop` | `number` | VBA Borders.DistanceFromTop: the `w:space` of the top side, in points. |
| `items` | `BorderUniversal[]` | read-only Top, Left, Bottom, Right, Between — the documented, stable order. |

**Not implemented.** These Office.js members throw: `applyPageBordersToAllSections`.

## `ColorFormat`

`Word.ColorFormat` over one DrawingML colour element; `rgb` writes an `a:srgbClr`.

Import from `@reductoai/docx/officejs`.

### ColorFormat properties

| Name | Type | Description |
| - | - | - |
| `rgb` | `string` | #RRGGBB of an `a:srgbClr`; empty for a theme or preset colour. |
| `type` | `"rgb" \| "scheme"` | read-only |

### `ColorFormat.set()`

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

## `ConditionalStyle`

Formatting of one table area of a table style (`w:tblStylePr`). Every write
creates the block on demand; deleting the last property in it removes the
empty block again (extension nicety).

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

### ConditionalStyle properties

| Name | Type | Description |
| - | - | - |
| `borders` | `BorderCollection` | read-only The block's `w:tcPr/w:tcBorders`, six locations including the inside pair. |
| `bottomPadding` | `number` | |
| `font` | `Font` | read-only The block's `w:rPr`; a member the block does not state reads undefined. |
| `leftPadding` | `number` | |
| `paragraphFormat` | `ParagraphFormat` | read-only The block's `w:pPr`; a member the block does not state reads undefined. |
| `rightPadding` | `number` | |
| `shading` | `Shading` | read-only The block's `w:tcPr/w:shd`; office.js types this ShadingUniversal. |
| `topPadding` | `number` | Points of cell padding the condition sets (`w:tcPr/w:tcMar`); 0 when unset. |

## `DocumentTheme`

Extension (VBA `Document.DocumentTheme`): the document's Office theme.

Import from `@reductoai/docx/officejs`.

### DocumentTheme properties

| Name | Type | Description |
| - | - | - |
| `themeColorScheme` | `ThemeColorScheme` | read-only |
| `themeFontScheme` | `ThemeFontScheme` | read-only |

## `DropCap`

Import from `@reductoai/docx/officejs`.

### DropCap properties

| Name | Type | Description |
| - | - | - |
| `distanceFromText` | `number` | Points between the letter and the text beside it (w:framePr/@w:hSpace). |
| `fontName` | `string` | The dropped letter's font; "" when there is no drop. |
| `linesToDrop` | `number` | Body lines the letter spans, 1 through 10; 0 when there is no drop. |
| `position` | `DropPosition` | None, Normal (in the text) or Margin (outside it). |

### `DropCap.clear()`

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

Remove the drop and give the letter back to its paragraph.

### `DropCap.enable()`

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

Drop the paragraph's first letter three lines, in the text; a drop already there stays.

### `DropCap.set()`

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

## `HeadingStyle`

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

### HeadingStyle properties

| Name | Type | Description |
| - | - | - |
| `level` | `number` | |
| `name` | `string` | |

### `HeadingStyle.delete()`

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

### `HeadingStyle.set()`

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

## `HeadingStyleCollection`

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

### HeadingStyleCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `HeadingStyle[]` | read-only |

### `HeadingStyleCollection.add()`

```ts theme={null}
add(name: string, level: number): HeadingStyle
```

## `ParagraphShadingUniversal`

Paragraph-backed shading: `w:pPr/w:shd`, read effective and written direct on
every covered paragraph. The disagree rule is TableColumn.shading's — "" for
the colors, "None" for the texture.

Import from `@reductoai/docx/officejs`. Extends [`ShadingUniversal`](https://docs.reducto.ai/office/docx/api/more-classes-text-and-formatting#shadinguniversal).

### ParagraphShadingUniversal properties

| Name | Type | Description |
| - | - | - |
| `backgroundPatternColor` | `string` | |
| `foregroundPatternColor` | `string` | |
| `texture` | `string` | |

### `ParagraphShadingUniversal.set()`

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

## `Shading`

The style's `w:shd`: `w:pPr/w:shd` on a paragraph style, `w:rPr/w:shd` on a
character style, `w:tcPr/w:shd` (whole-table cell shading) on a table style.

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

### Shading properties

| Name | Type | Description |
| - | - | - |
| `backgroundPatternColor` | `string` | |
| `foregroundPatternColor` | `string` | |
| `texture` | `string` | Absent shading reads "None", office.js's token for `w:val="clear"`. |

### `Shading.set()`

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

## `ShadingUniversal`

Shading over one backing, including the OOXML foreground/pattern attributes.

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

### ShadingUniversal properties

| Name | Type | Description |
| - | - | - |
| `backgroundPatternColor` | `string` | |
| `foregroundPatternColor` | `string` | |
| `texture` | `string` | |

### `ShadingUniversal.set()`

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

## `StyleCollection`

Live view over the styles part: every access re-reads `w:styles`.

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

### StyleCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `Style[]` | read-only |
| `length` | `number` | read-only Extension: OfficeJS loads items and reads items.length. |

### `StyleCollection.at()`

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

Extension matching the HandleCollection convention; negative indices count from the end.

### `StyleCollection.getByName()`

```ts theme={null}
getByName(name: string): Style
```

### `StyleCollection.getByNameOrNullObject()`

```ts theme={null}
getByNameOrNullObject(name: string): Style
```

### `StyleCollection.getCount()`

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

### `StyleCollection.getItem()`

```ts theme={null}
getItem(index: number): Style
```

## `ThemeColorScheme`

Extension (VBA `Document.DocumentTheme.ThemeColorScheme`): the twelve colours every theme
colour reference resolves through. A change rewrites the colours that use the slot, as Word does.

Import from `@reductoai/docx/officejs`.

### ThemeColorScheme properties

| Name | Type | Description |
| - | - | - |
| `name` | `string` | read-only The scheme's name (a:clrScheme/@name), as Design > Colors lists it. |

### `ThemeColorScheme.getColor()`

```ts theme={null}
getColor(index: ThemeColorIndex): string
```

VBA `Colors(index).RGB`, as #RRGGBB.

### `ThemeColorScheme.load()`

```ts theme={null}
load(name: string): void
```

VBA ThemeColorScheme.Load with one of Word's built-in Design > Colors names ("Blue Warm").

### `ThemeColorScheme.set()`

```ts theme={null}
set(colors: Partial<Record<ThemeColorIndex, string>>): void
```

Several slots in one write.

### `ThemeColorScheme.setColor()`

```ts theme={null}
setColor(index: ThemeColorIndex, color: string): void
```

## `ThemeFontScheme`

Extension (VBA `DocumentTheme.ThemeFontScheme`): the heading (major) and body (minor) theme faces.

Import from `@reductoai/docx/officejs`.

### ThemeFontScheme properties

| Name | Type | Description |
| - | - | - |
| `majorFont` | `string` | VBA MajorFont(msoThemeLatin).Name: the headings face. |
| `minorFont` | `string` | VBA MinorFont(msoThemeLatin).Name: the body face. |
| `name` | `string` | read-only |

### `ThemeFontScheme.load()`

```ts theme={null}
load(name: string): void
```

VBA ThemeFontScheme.Load with one of Word's built-in Design > Fonts names ("Office 2013 - 2022").

### `ThemeFontScheme.set()`

```ts theme={null}
set(fonts: { majorFont?: string; minorFont?: string }): void
```

Both faces in one write; the scheme is renamed "Custom", as Word names an edited one.
