-
Notifications
You must be signed in to change notification settings - Fork 517
word formfield
zmworm edited this page Apr 29, 2026
·
30 revisions
Legacy form fields (FORMTEXT, FORMCHECKBOX, FORMDROPDOWN) for fillable documents.
Path: /formfield[N] or /formfield[Name]
Parent: /body
| Property | Default | Description |
|---|---|---|
type |
text |
Field type: text, checkbox, dropdown
|
name |
- | Field name/identifier |
value / text
|
- | Current value (text field content, or selected item) |
checked |
false |
Checkbox state (bool) |
default |
- | Default value |
maxLength |
- | Max character length (text fields) |
enabled |
true |
Whether the field is editable |
items |
- | Comma-separated dropdown items |
# Add a text form field
officecli add report.docx /body --type formfield --prop name=employeeName --prop type=text --prop default="Enter name"
# Add a checkbox
officecli add report.docx /body --type formfield --prop name=agreeTerms --prop type=checkbox --prop checked=false
# Add a dropdown
officecli add report.docx /body --type formfield --prop name=department --prop type=dropdown --prop items="Sales,Engineering,Marketing,HR"# Update text field value
officecli set report.docx /formfield[employeeName] --prop value="John Doe"
# Toggle checkbox
officecli set report.docx /formfield[agreeTerms] --prop checked=true
# Disable a field
officecli set report.docx /formfield[1] --prop enabled=falseofficecli get report.docx /formfield[1]
officecli get report.docx /formfield[employeeName]Returns: name, type, value/checked, enabled, editable (based on protection + enabled state).
Form fields appear in view text and view annotated output:
[/body/p[3]] [ff:employeeName|text|John Doe]
[/body/p[5]] [ff:agreeTerms|checkbox|☑]
[/body/p[7]] [ff:department|dropdown|Sales]
- Use document protection mode
formsto make only form fields editable:officecli set report.docx / --prop protection=forms - Access by name (
/formfield[employeeName]) or by index (/formfield[1]).
- Document set - Document protection
- SDT/Content Control - Modern content controls
- Word Reference - All Word elements
Based on OfficeCLI v1.0.64