# OfficeCLI view html vs view screenshot vs view outline: Choosing the Right Inspection Mode

> Explore OfficeCLI view html view screenshot and view outline to choose the best inspection mode for your needs Understand their unique capabilities for preview capture and extraction.

- Repository: [OfficeAI/OfficeCLI](https://github.com/iofficeai/OfficeCLI)
- Tags: deep-dive
- Published: 2026-07-12

---

**OfficeCLI provides three specialized view commands—`view html` for interactive browser previews, `view screenshot` for pixel-perfect headless captures, and `view outline` for hierarchical text extraction—each implemented in dedicated resource scripts within the iOfficeAI/OfficeCLI repository.**

The iOfficeAI/OfficeCLI repository generates HTML-based slide decks from Office documents, and understanding the differences between OfficeCLI view html vs view screenshot vs view outline ensures you select the optimal workflow for documentation, sharing, or content auditing. Each command operates on the same underlying document model but presents it through a distinct format tailored to specific inspection needs.

## Interactive HTML Preview with `view html`

The `view html` command launches an interactive browser preview of your generated slides. According to the source code in [`src/officecli/Resources/preview.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/preview.js), this mode scales slides to fit the viewport using the **`scaleSlides`** function and provides a sidebar thumbnail navigation system.

Key features implemented in **preview.js** include:

- **Dynamic scaling**: The `scaleSlides` function automatically adjusts slide dimensions when the browser window resizes.
- **Fullscreen navigation**: Keyboard shortcuts trigger **`enterFullscreen`** and **`exitFullscreen`** functions for presentation mode.
- **Thumbnail sidebar**: Generated via DOM manipulation, toggleable using **`toggleSidebar()`**.

```bash

# Launch interactive HTML preview in default browser

officecli view html path/to/document.docx

```

Once opened, you can navigate between slides using arrow keys, toggle the thumbnail sidebar, and activate fullscreen mode with the `f` key.

## Headless Screenshot Capture with `view screenshot`

When you need pixel-perfect images without browser chrome, the `view screenshot` command runs the document in a headless browser and streams back a rendered bitmap. This logic resides in [`src/officecli/Resources/watch-sse-core.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/watch-sse-core.js), which forces the slide to fill the viewport using the **`fill`** flag and removes the 40px "breathing room" to match exact slide dimensions.

The screenshot mechanism supports targeting specific slides via the **`--slide`** parameter. Omitting this flag captures the first slide by default.

```bash

# Capture slide 3 as PNG

officecli view screenshot --slide 3 path/to/document.docx > slide3.png

# Capture first slide (default)

officecli view screenshot path/to/document.docx > slide1.png

```

This approach is ideal for generating documentation images or sharing static previews where UI interaction is unnecessary.

## Textual Outline Extraction with `view outline`

For quick content audits or table-of-contents generation, `view outline` produces a plain-text hierarchy of slide titles and headings. The implementation in [`src/officecli/Resources/watch-overlay.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/watch-overlay.js) traverses the slide DOM, extracts textual headings, and prints them with depth indicators (e.g., `1. Title`, `1.1. Section`).

This output streams directly to stdout, making it easy to pipe into other tools for further processing or script automation.

```bash

# Generate hierarchical outline

officecli view outline path/to/document.docx

```

The command walks the DOM structure to identify heading levels, preserving the nested organization of your presentation content.

## Command Parsing and SDK Integration

All three view commands are parsed in [`src/officecli/CommandBuilder.GetQuery.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/CommandBuilder.GetQuery.cs), which forwards arguments to the appropriate resource scripts. For programmatic access, the Node SDK exposes identical functionality through **[`sdk/node/index.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/sdk/node/index.js)**, allowing you to invoke these view modes from JavaScript applications without shelling out to the CLI.

## Summary

- **OfficeCLI view html** ([`src/officecli/Resources/preview.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/preview.js)): Interactive browser preview with scaling, thumbnails, and fullscreen keyboard navigation.
- **OfficeCLI view screenshot** ([`src/officecli/Resources/watch-sse-core.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/watch-sse-core.js)): Headless pixel-perfect image capture with optional slide targeting via `--slide`.
- **OfficeCLI view outline** ([`src/officecli/Resources/watch-overlay.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Resources/watch-overlay.js)): DOM-based text extraction producing hierarchical outlines with depth prefixing.

## Frequently Asked Questions

### When should I use view html versus view screenshot?

Use **`view html`** when you need to review slide layouts interactively or navigate through a presentation with the thumbnail sidebar and keyboard shortcuts. Choose **`view screenshot`** when you need static, pixel-perfect images for documentation, sharing, or version control systems where interactive content is inappropriate.

### Can I capture specific slides using view screenshot?

Yes. The **`view screenshot`** command accepts a `--slide` flag followed by the slide number. For example, `officecli view screenshot --slide 3 document.docx` captures only the third slide. If you omit the flag, the command defaults to capturing the first slide.

### What format does view outline produce?

The **`view outline`** command outputs plain text to stdout, displaying slide titles and headings in a hierarchical format with depth indicators like `1. Title` and `1.1. Subsection`. This format is designed for easy parsing by scripts or for quick visual inspection of document structure.

### Is there a programmatic API for these view commands?

Yes. The iOfficeAI/OfficeCLI repository includes a Node SDK in [`sdk/node/index.js`](https://github.com/iOfficeAI/OfficeCLI/blob/main/sdk/node/index.js) that exposes the same functionality available through the CLI. You can programmatically trigger HTML previews, screenshots, and outline generation from within Node.js applications without executing shell commands.