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

# @reductoai/pptx/editor

The headless slide editor: commands, selection and undo over a deck. Guide: [Headless editor](https://docs.reducto.ai/office/pptx/ui/headless-editor.md).

## `PptxEditor`

Headless slide editing over the PowerPoint facade: commands in, a laid-out view out.

Import from `@reductoai/pptx/editor`.

### PptxEditor properties

| Name | Type | Description |
| - | - | - |
| `presentation` | `PowerPointPresentation` | read-only |
| `pendingSlides` | `number` | read-only Slides still blank in Normal view (`progressive`). |
| `slideCount` | `number` | read-only |
| `view` | `EditorView` | read-only |

### `PptxEditor.open()`

```ts theme={null}
static open(bytes: Uint8Array, options?: PptxEditorOptions): Promise<PptxEditor>
```

### `apply()`

```ts theme={null}
apply(command: PptxCommand): Promise<EditorView>
```

### `backgroundStyles()`

```ts theme={null}
backgroundStyles(): BackgroundStylePreview[]
```

Design > Background Styles: the twelve cells as the current page's theme draws them.

### `chartWorkbook()`

```ts theme={null}
chartWorkbook(): ChartWorkbook | undefined
```

The selected chart's workbook for Edit Data; undefined when it reads none it embeds.

### `clipPicture()`

```ts theme={null}
clipPicture(): Promise<ClipPicture | undefined>
```

Paste Special > Picture: the copied shapes alone on a page with no background, and the box
their ink covers (hmm). The host paints that box and adds it with `addPicture`.

### `commentStep()`

```ts theme={null}
commentStep(by: -1 | 1, active?: string | null): CommentStop | undefined
```

Review > Previous or Next from `active`, the thread a host's pane shows; undefined when the deck has none.

### `connectionSites()`

```ts theme={null}
connectionSites(): ConnectionSite[]
```

Where a connector end can glue on the current slide: each site of each shape, in page hmm.

### `external()`

```ts theme={null}
external<T>(run: () => Promise<T>): Promise<T>
```

Runs an edit made around the editor (a script, an agent) on `presentation` as one undo step,
then lays every slide out again. Edits made before a throw stand; a run that changed nothing
adds no step.

### `find()`

```ts theme={null}
find(query: string, options?: { matchCase?: boolean }): FindHit[]
```

Every match of `query` in the deck (or the masters in Master view), slide by slide in shape order.

### `headerFooter()`

```ts theme={null}
headerFooter(slide?: number): HeaderFooterSettings | undefined
```

What Insert > Header & Footer shows for a slide.

### `layoutPending()`

```ts theme={null}
layoutPending(count?: number): Promise<EditorView>
```

Lays out up to `count` blank slides, nearest the one on screen first, and returns the view;
`pendingSlides` says how many are left.

### `layoutPreviews()`

```ts theme={null}
layoutPreviews(): Promise<LayoutDocument>
```

One page per entry of `view.layouts`, for the Layout gallery's thumbnails; laid again only after an edit.

### `link()`

```ts theme={null}
link(): LinkState | undefined
```

What Insert > Link shows: the selection's link, its text to display; undefined where a link cannot go.

### `mediaBlob()`

```ts theme={null}
mediaBlob(part: string, type?: string): Blob | null
```

A media part a picture plays (`SlideObject.media.part`) as a Blob of `type`; null when the package lacks it.

### `mediaTiming()`

```ts theme={null}
mediaTiming(slide?: number): MediaTiming
```

How the slide's videos and sounds play: settings, start and click calls, triggers.

### `merge()`

```ts theme={null}
merge(run: () => Iterable<string>): Promise<EditorView>
```

Writes another writer's change (`run` returns the parts it wrote) and lays out what it
touched, keeping the selection on the same shapes and text. Undo steps made before it
would put back its parts too, so they are dropped.

### `notesPage()`

```ts theme={null}
notesPage(slide?: number): NotesPage | undefined
```

View > Notes Page: the frames of a slide's notes page; undefined in Master view.

### `notesText()`

```ts theme={null}
notesText(slide?: number): string
```

A slide's speaker notes: paragraphs joined with "\r", line breaks as "\v".

### `outline()`

```ts theme={null}
outline(): OutlineSlide[]
```

Outline View: each slide's title and body placeholder paragraphs; empty in Master view.

### `peerView()`

```ts theme={null}
peerView(presence: PptxPresence): PeerView | null
```

Where another writer's presence lands here; null when its page is gone.

### `presence()`

```ts theme={null}
presence(): PptxPresence | null
```

This writer's place, for other writers to show.

### `presentationFonts()`

```ts theme={null}
presentationFonts(): string[]
```

The faces the deck's text uses, for Replace Fonts' Replace list.

### `refresh()`

```ts theme={null}
refresh(): Promise<EditorView>
```

Lays out again each slide an edit or a face the host has fetched since reaches.

### `selectedSpan()`

```ts theme={null}
selectedSpan(): CommentSpan | undefined
```

The selected characters of a shape's own text (not a table cell's), as a comment points at them.

### `selectedText()`

```ts theme={null}
selectedText(): string
```

The selected text, or the empty string outside text mode.

### `selectionPane()`

```ts theme={null}
selectionPane(): PaneItem[]
```

The Selection Pane: the slide's shapes, hidden ones too, front-most first; a group lists its own.

### `slideObjects()`

```ts theme={null}
slideObjects(slide: number): readonly SlideObject[]
```

A slide's shapes, as the view lists them for the slide on screen.

### `slideShow()`

```ts theme={null}
slideShow(): ShowSlide[]
```

Every slide as a show plays it, in deck order; hidden slides are listed and marked.

### `storyText()`

```ts theme={null}
storyText(story: string, slide?: number): string
```

The plain text of a story, paragraphs joined with "\r" (PowerPoint's TextRange).

### `tableStyles()`

```ts theme={null}
tableStyles(): TableStyleChoice[]
```

Table Design's style gallery for the selected table: the deck's styles, then the built-ins, each with a preview.

### `textFormat()`

```ts theme={null}
textFormat(): TextFormat | undefined
```

The laid style where typing would land, the run before the caret; a range shows what all its characters share.

### `toBytes()`

```ts theme={null}
toBytes(): Promise<Uint8Array<ArrayBufferLike>>
```

## `PptxEditorOptions`

Headless slide editing over the PowerPoint facade: commands in, a laid-out view out.

Import from `@reductoai/pptx/editor`.

| Name | Type | Description |
| - | - | - |
| `measure?` | `MeasureText` | Text widths for caret placement; defaults to the layout's own measurer. |
| `onProgress?` | `ProgressCallback` | Parse and layout events of the first layout, one page per slide. |
| `progressive?` | `boolean` | Lay out only the slide on screen when the deck opens or changes as a whole; the others show blank until `layoutPending` lays them. For a host that paints while the rest lays out. |
