-
Notifications
You must be signed in to change notification settings - Fork 517
word sdt add
zmworm edited this page Apr 29, 2026
·
50 revisions
Add structured document tags (content controls) for forms and structured content.
Type: sdt/contentcontrol
Parent: /body (block-level) or /body/p[N] (inline)
| Property | Default | Description |
|---|---|---|
sdtType/controltype
|
text |
Control type: text, richtext, dropdown, combobox, date
|
alias/name
|
- | Display name |
tag |
- | Tag identifier |
lock |
unlocked |
Lock mode: unlocked, contentlocked, sdtlocked, sdtcontentlocked
|
text |
- | Default text content |
items |
- | Comma-separated items (for dropdown/combobox) |
format |
yyyy-MM-dd |
Date format (for date type) |
# Add a plain text content control
officecli add report.docx /body --type sdt --prop sdtType=text --prop alias="Name" --prop tag="name" --prop text="Enter name"
# Add a dropdown content control
officecli add report.docx /body --type contentcontrol --prop controltype=dropdown --prop alias="Status" --prop items="Draft,Review,Final"
# Add a date picker content control
officecli add report.docx /body --type sdt --prop sdtType=date --prop alias="Due Date" --prop format="MM/dd/yyyy"
# Add a locked content control (content cannot be edited)
officecli add report.docx /body --type sdt --prop sdtType=richtext --prop lock=contentlocked --prop text="Protected content"
# Add an inline content control within a paragraph
officecli add report.docx /body/p[1] --type sdt --prop sdtType=text --prop alias="Inline Field" --prop text="fill in"
# Add a combobox (editable dropdown)
officecli add report.docx /body --type sdt --prop sdtType=combobox --prop alias="Department" --prop items="Sales,Engineering,Marketing,Other"Based on OfficeCLI v1.0.64