-
Notifications
You must be signed in to change notification settings - Fork 541
command query word
zmworm edited this page Mar 18, 2026
·
51 revisions
Query selectors for Word documents.
| Selector | Aliases | Description |
|---|---|---|
paragraph |
p |
Paragraphs |
run |
r |
Text runs (child selector only, use with >) |
table |
tbl |
Tables |
picture |
image, img
|
Inline images |
equation |
math, formula
|
Equations |
bookmark |
- | Bookmarks |
header |
- | Headers |
footer |
- | Footers |
chart |
- | Charts |
comment |
- | Comments |
| Attribute | Description |
|---|---|
style |
Style name or ID (case-insensitive) |
alignment |
left, center, right, justify
|
firstLineIndent |
Indent value |
numId |
Numbering ID |
numLevel / ilvl
|
Numbering level |
listStyle |
List style |
| Attribute | Description |
|---|---|
font |
Font name |
size |
Font size |
bold |
Boolean |
italic |
Boolean |
| Selector | Applies To | Description |
|---|---|---|
:contains("text") |
paragraphs, runs | Contains text |
:empty |
paragraphs | No content |
:no-alt |
pictures | Missing alt text |
# All Heading 1 paragraphs
officecli query report.docx "p[style=Heading1]"
# Bold runs in centered paragraphs
officecli query report.docx "p[alignment=center] > r[bold=true]"
# Runs containing specific text
officecli query report.docx 'r:contains("error")'
# Empty paragraphs
officecli query report.docx "p:empty"
# Images without alt text
officecli query report.docx "image:no-alt"
# Paragraphs NOT in Normal style
officecli query report.docx "p[style!=Normal]"
# All bookmarks
officecli query report.docx "bookmark"
# All equations
officecli query report.docx "equation"- query - Command syntax
- Word Reference - All Word elements
Based on OfficeCli v1.0.6