Skip to content

command view word

zmworm edited this page Apr 4, 2026 · 28 revisions

view - Word (.docx)

View modes for Word documents.

text

Plain text content with element paths.

Output format:

[/body/p[N]] text content
[/body/p[N]] • bulleted item (list prefix)
[/body/tbl[N]] [Table: {rows} rows]
[/body/oMathPara[N]] [Equation] readable math text
[/body/p[N]] [sdt:TagName] content control text
[/body/p[N]] [ff:fieldName|text|value]
... (showed {N} rows, {total} total, use --start/--end to view more)

Example output:

[/body/p[1]] Complex Math Formula Collection
[/body/p[2]] I. Algebra
[/body/oMathPara[1]] [Equation] x = (-b ± √(b² - 4ac)) / 2a
[/body/p[3]] This is regular text.
[/body/tbl[1]] [Table: 5 rows]

annotated

Text with formatting details. Shows style, font, size for each run. Equations shown as LaTeX.

Output format:

[/body/p[N]] 「text content」 ← StyleName | FontName, 12pt, bold, italic
[/body/p[N]] [] <-- empty paragraph
[/body/p[N]] [Equation: "LaTeX formula"] ← display
[/body/p[N]] [Equation: "LaTeX formula"] ← StyleName | inline
[/body/p[N]] [Image: description] ← StyleName
[/body/tbl[N]] [Table: {rows}×{cols}]

Example output:

[/body/p[1]] 「Chapter 1」 ← Heading1 | Arial, 16pt, bold
[/body/p[2]] 「This is body text.」 ← Normal | Calibri, 11pt
[/body/p[3]] [] <-- empty paragraph
[/body/p[4]] [Equation: "\frac{-b \pm \sqrt{b^{2}-4ac}}{2a}"] ← display
[/body/tbl[1]] [Table: 3×4]

Fields:

  • [/body/p[N]] — Element path (usable with get/set/remove)
  • 「text」 — Run text content (in corner brackets)
  • ← StyleName — Paragraph style
  • | FontName, size, bold, italic — Run formatting (comma-separated modifiers)
  • [Equation: "..."] — LaTeX formula
  • [Image: ...] — Image with description
  • [Table: rows×cols] — Table dimensions

outline

Document structure: file stats, watermark, headers/footers, heading hierarchy.

Output format:

File: {filename} | {N} paragraphs | {N} tables | {N} images | {N} equations
Watermark: "{text}"
Header: "{text}"
Footer: "{text}"

├── [N] "Heading text" (Heading1)
  ├── [N] "Sub-heading" (Heading2)
    ├── [N] "Sub-sub-heading" (Heading3)
■ [N] "Title text" (Title)

stats

Style and font usage statistics.

Output format:

Paragraphs: {N} | Words: {N} | Total Characters: {N}

Style Distribution:
  Normal: {count}
  Heading1: {count}
  ...

Font Usage:
  Calibri: {count}
  Arial: {count}
  ...

Font Size Usage:
  11pt: {count}
  14pt: {count}
  ...

Empty Paragraphs: {count}
Consecutive Spaces: {count} occurrences

issues

Formatting/content/structure problems. Grouped by category.

Output format:

Found {N} issue(s):

Structure Issues ({count}):
  [S1] /body/p[5]: Empty paragraph

Format Issues ({count}):
  [F1] /body/p[3]: Body paragraph missing first-line indent

Content Issues ({count}):
  [C1] /body/p[7]: Consecutive spaces
       Context: "word  word"
       Suggestion: Merge into a single space
  [C2] /body/p[8]: Duplicate punctuation
  [C3] /body/p[9]: Mixed CJK/Latin punctuation

Issue fields:

  • Id — Identifier (S=Structure, F=Format, C=Content + number)
  • Path — Element path
  • Message — Problem description
  • Context — Surrounding text (optional)
  • Suggestion — How to fix (optional)

Issue types for --type filter: format/f, content/c, structure/s

html

Renders the document as a self-contained HTML page with full formatting fidelity.

Supports: paragraph/run formatting with style inheritance (font-metrics-based line-height per paragraph), tables (including borderless layout tables, merged cells, floating tables with text wrapping, table style conditional formatting, theme border colors), images with crop and anchored positioning, text boxes, shape groups, drop caps, multi-column sections, footnotes/endnotes (configurable numbering format, pagination, style-resolved font size), TOC rendering, embedded charts (SVG), math equations (KaTeX), run borders/shading, headers/footers, page layout/margins from OOXML, tracked insertions, CJK fonts with visual punctuation and auto-spacing, theme colors, font loading.

Behavior:

  • Default: outputs raw HTML to stdout.
  • With --browser: writes HTML to a temp file, opens it in the default browser.
  • Supports --start/--end to limit pages.
  • Supports --page to select specific pages (e.g., --page 1,3,5 or --page 2-5).
# Output HTML to stdout
officecli view report.docx html

# Open in browser
officecli view report.docx html --browser

# Render specific pages only
officecli view report.docx html --page 1,3,5
officecli view report.docx html --page 2-5

# Pipe to file
officecli view report.docx html > preview.html

For a live preview that auto-refreshes on every change, use the watch command instead.

Examples

officecli view report.docx text
officecli view report.docx text --start 1 --end 50
officecli view report.docx text --max-lines 100
officecli view report.docx annotated
officecli view report.docx outline
officecli view report.docx stats
officecli view report.docx issues
officecli view report.docx issues --type format --limit 10
officecli view report.docx html
officecli view report.docx text --json

See Also


Based on OfficeCLI v1.0.33

Clone this wiki locally