# OfficeCLI PowerPoint Commands: How to Manipulate Presentations from the Terminal

> Master OfficeCLI PowerPoint commands to edit presentations directly from your terminal. Discover essential command examples for zero-install manipulation of OpenXML files.

- Repository: [OfficeAI/OfficeCLI](https://github.com/iofficeai/OfficeCLI)
- Tags: how-to-guide
- Published: 2026-07-18

---

**OfficeCLI enables zero-install creation, editing, and inspection of PowerPoint files through a three-tier command architecture that operates directly on the OpenXML package without launching Microsoft Office.**

OfficeCLI treats `.pptx` files as hierarchical document models that agents and developers can manipulate entirely from the terminal. The tool provides atomic, in-memory operations on slides, shapes, tables, and animations through a native binary downloaded lazily on first use, as implemented in the iOfficeAI/OfficeCLI repository.

## Understanding the Three-Level Command Architecture

OfficeCLI exposes three logical layers for manipulating PowerPoint documents, each designed for different levels of abstraction and control.

**L1 Read commands** (`view`, `watch`) render presentations as HTML, PNG screenshots, or text outlines for immediate visual feedback. These commands parse the OpenXML structure and generate human-readable previews without requiring Microsoft Office installation.

**L2 DOM commands** (`add`, `set`, `remove`, `move`, `query`, `get`) operate on the semantic element tree using OOXML-style paths such as `/slide[1]/shape[2]`. These commands accept `--type` and `--prop` flags to specify element types and properties programmatically.

**L3 Raw XML commands** (`raw`, `raw-set`, `add-part`) provide direct XPath access to the underlying package parts when features are not yet exposed through the higher-level DOM API.

## Creating and Inspecting Presentations

All PowerPoint manipulation follows the syntax pattern: `officecli <command> <file.pptx> <path> [--type <element>] [--prop key=value]`.

Create a blank presentation and add your first slide:

```bash

# Create an empty .pptx file

officecli create deck.pptx

# Add a new slide with a title

officecli add deck.pptx / --type slide --prop title="Q4 Report" --prop background=1A1A2E

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (lines 94-102)

Verify your document structure without opening PowerPoint:

```bash

# View as text outline

officecli view deck.pptx outline

# Render to HTML for visual inspection

officecli view deck.pptx html

```

The `outline` command outputs a hierarchical tree showing slide indices and shape types, while `html` launches a rendered preview in your default browser.

## Adding Slides, Shapes, and Charts

Populate slides by targeting specific paths and declaring element types through the `--type` flag.

Add a text box to the first slide with positioning and font properties:

```bash
officecli add deck.pptx '/slide[1]' --type shape \
  --prop text="Revenue grew 25%" \
  --prop x=2cm --prop y=5cm \
  --prop font=Arial --prop size=24 --prop color=FFFFFF

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (lines 110-118)

Insert data visualizations using the chart type with JSON data payloads:

```bash
officecli add deck.pptx '/slide[1]' --type chart \
  --prop chartType=pie \
  --prop data='[{"label":"A","value":30},{"label":"B","value":70}]' \
  --prop x=1cm --prop y=2cm --prop w=10cm --prop h=6cm

```

The command parser validates chart types and dimensions before serializing the embedded Excel data and chart XML into the presentation package.

## Modifying Content with Set and Remove

Update existing elements using the `set` command with OOXML path targeting, or remove elements entirely.

Retrieve structured JSON metadata for a specific shape to verify its current state:

```bash
officecli get deck.pptx '/slide[1]/shape[1]' --json

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (lines 124-130)

Modify shape properties atomically:

```bash
officecli set deck.pptx '/slide[1]/shape[1]' --prop font=Courier

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (line 565)

Apply animations and transitions through the same interface:

```bash
officecli set deck.pptx '/slide[1]/shape[1]' \
  --type animation --prop preset=fadeIn --prop duration=2s

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (lines 183-190)

## Live Preview with Watch Mode

Enable iterative editing with automatic browser refreshes using the `watch` command, implemented in [`src/officecli/Resources/watch-overlay.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/watch-overlay.js).

```bash

# Start local server on port 26315

officecli watch deck.pptx

# In another terminal, edit while the browser updates instantly

officecli set deck.pptx '/slide[1]' --prop background=FFFFFF

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (lines 97-104)

The watch overlay highlights selected elements when editing documents, providing visual feedback synchronized with DOM operations.

## Batch Operations for Atomic Updates

Execute multiple edits as a single atomic transaction to prevent package corruption during complex scripts.

```bash
officecli batch deck.pptx --commands '
[
  {"op":"add","path":"/slide[2]","type":"slide","props":{"title":"Conclusion"}},
  {"op":"set","path":"/slide[2]/shape[1]","props":{"text":"Thanks!"}}
]
' --json

```

*Source:* [`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md) (lines 20-28)

The batch processor validates the entire command array before modifying the in-memory document model, ensuring all changes persist or none apply.

## Implementation Details

OfficeCLI routes all commands through a Node.js shim that spawns a native binary capable of parsing and writing OpenXML packages in-memory. Key implementation files include:

- **[`npm/officecli.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/npm/officecli.js)**: Entry point that launches the native binary when the `officecli` command is invoked.
- **[`sdk/node/index.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/sdk/node/index.js)**: High-level command parser that validates OOXML paths and forwards requests to the binary.
- **[`src/officecli/Resources/watch-overlay.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/watch-overlay.js)**: Implements the live-preview server and selection highlighting for the `watch` command.
- **[`README.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/README.md)**: Comprehensive command reference and usage examples for PowerPoint manipulation.

The native binary handles the actual `pptx` package manipulation, guaranteeing atomic updates while maintaining zero-install dependencies for end users.

## Summary

- OfficeCLI provides **three command tiers** (Read, DOM, Raw XML) for complete control over PowerPoint documents.
- The **unified syntax** uses OOXML paths (`/slide[1]/shape[2]`) with `--type` and `--prop` flags to target elements.
- **Live preview** via `watch` mode enables iterative development without opening Microsoft Office.
- **Batch operations** ensure atomic updates when scripting complex presentation modifications.
- All commands execute through a **native binary** managed by the Node.js SDK at [`sdk/node/index.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/sdk/node/index.js).

## Frequently Asked Questions

### How does OfficeCLI handle PowerPoint files without Microsoft Office installed?

OfficeCLI parses the OpenXML package directly using a native binary that understands the `.pptx` file structure. According to the iOfficeAI/OfficeCLI source code, the tool manipulates the XML parts in-memory and re-zips the package atomically, eliminating dependencies on Microsoft Office or COM automation.

### What is the difference between the `add` and `set` commands in OfficeCLI?

The **`add`** command creates new elements at the specified OOXML path and requires the `--type` flag to declare what kind of slide, shape, or chart to instantiate. The **`set`** command modifies existing elements identified by their path, accepting `--prop` flags to update attributes like `font`, `color`, or `text` without changing the element type.

### Can OfficeCLI manipulate animations and transitions programmatically?

Yes. OfficeCLI exposes animations through the L2 DOM layer using `set --type animation` with properties like `preset` and `duration`. The command targets specific shapes via their OOXML path (e.g., `/slide[1]/shape[1]`) and serializes the animation XML into the slide's timing tree, as documented in the repository's animation examples.

### How do I verify changes before saving when using OfficeCLI?

Use **`officecli view deck.pptx outline`** for a quick text-based hierarchy check or **`officecli view deck.pptx html`** to render the presentation in a browser. For continuous verification during editing, run **`officecli watch deck.pptx`** to start a local server that refreshes automatically whenever the file changes.