How to Use OfficeCLI's Built‑In Help System to Discover Element Properties
OfficeCLI ships with a self‑contained help engine that reads bundled Office schema files and renders element properties on‑demand via the officecli help command.
The iOfficeAI/OfficeCLI repository provides a command‑line interface for automating Office documents. A standout feature is its integrated help system, which lets you inspect the properties of Word, Excel, and PowerPoint elements without leaving the terminal. This guide covers how to use the help system to discover element properties, navigate nested structures, and extract machine‑readable documentation.
Core Help System Architecture
The help engine resides in src/officecli/Help/ and consists of three cooperating components:
- SchemaHelpLoader (
src/officecli/Help/SchemaHelpLoader.cs) — loads and caches JSON schema definitions from the repository'sschemas/directory. - SchemaHelpRenderer (
src/officecli/Help/SchemaHelpRenderer.cs) — formats schema data into human‑readable console tables. - SchemaHelpFlatRenderer (
src/officecli/Help/SchemaHelpFlatRenderer.cs) — produces JSON output when the--jsonflag is supplied.
The CommandBuilder.Help.cs file (src/officecli/CommandBuilder.Help.cs) wires the help sub‑command into the CLI's dispatch pipeline, forwarding element names and flags to the appropriate renderer.
Listing All Available Elements
To see every top‑level element the CLI recognizes, run the help command without arguments:
officecli help
This prints a concise catalogue of supported elements across Word, Excel, and PowerPoint. Use this as your starting point before drilling into specific properties.
Inspecting Element Properties
Once you know an element name, inspect its properties by passing it as an argument:
officecli help Paragraph
The output displays a table with four columns:
- Property name — the attribute identifier.
- Type — the data type (string, integer, object, array, etc.).
- Default value — the fallback if unset.
- Description — a brief explanation of the property's purpose.
Navigating Nested Properties with Dot Notation
Many Office elements contain hierarchical structures. The help system supports dot‑notation paths to drill into nested objects.
For example, to inspect the font configuration within a paragraph's style:
officecli help Paragraph.Style.Font
You can continue chaining properties to reach deeply nested attributes:
officecli help Paragraph.Style.Font.Size
This traversal mirrors the object model you would use in actual OfficeCLI scripts, making the help output directly applicable to your automation code.
Extracting Machine‑Readable Documentation
For scripting, CI/CD pipelines, or documentation generators, append the --json flag:
officecli help Table --json
The JSON format includes the same property metadata in a structured schema suitable for parsing with jq, Python, or other tools.
Practical Code Examples
# Discover all available elements
officecli help
# Inspect a Word table's properties
officecli help Table
# Examine Excel cell formatting options
officecli help Cell.Format
# Export PowerPoint slide properties to JSON
officecli help Slide --json > slide_schema.json
# Deep-dive into nested Word paragraph styling
officecli help Paragraph.Style.ParagraphFormat.SpaceAfter
Key Implementation Files
Understanding the source structure helps when extending or debugging the help system:
| File | Purpose |
|---|---|
src/officecli/Help/SchemaHelpLoader.cs |
Loads and caches JSON schema definitions from schemas/. |
src/officecli/Help/SchemaHelpRenderer.cs |
Renders human‑readable console tables. |
src/officecli/Help/SchemaHelpFlatRenderer.cs |
Generates JSON output for --json requests. |
src/officecli/Help/SchemaCrc.cs |
Computes checksums to detect schema file changes. |
src/officecli/CommandBuilder.Help.cs |
Implements the help sub‑command and argument parsing. |
Summary
- Use
officecli helpwithout arguments to list all supported Office elements. - Pass an element name like
officecli help Paragraphto inspect its properties. - Navigate nested structures with dot notation:
Paragraph.Style.Font.Size. - Add
--jsonfor machine‑readable output suitable for automation. - The help engine sources data from bundled JSON schemas in
schemas/viaSchemaHelpLoaderand renders throughSchemaHelpRendererorSchemaHelpFlatRenderer.
Frequently Asked Questions
Does OfficeCLI's help system work offline?
Yes. The help system reads static JSON schema files bundled in the repository's schemas/ directory. SchemaHelpLoader loads these at runtime, so no network connection is required after installation.
How do I find the correct property path for nested elements?
Start with the top‑level element (officecli help Paragraph), identify the property you need, then append it with a dot. Repeat this process—running officecli help at each level—until you reach the desired nested property. The console output clearly indicates which properties are objects versus scalars.
Can I use the help output to generate client code?
Absolutely. The --json flag produces structured schema data from SchemaHelpFlatRenderer that you can pipe into code generators. The JSON includes property names, types, defaults, and descriptions—everything needed to scaffold type definitions or validation logic in languages like TypeScript, Python, or C#.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →