Skip to content

word formfield

zmworm edited this page Apr 29, 2026 · 30 revisions

Word: Form Field

Legacy form fields (FORMTEXT, FORMCHECKBOX, FORMDROPDOWN) for fillable documents.

Path: /formfield[N] or /formfield[Name]

add

Parent: /body

Properties

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

Examples

# 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"

set

# 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=false

get

officecli get report.docx /formfield[1]
officecli get report.docx /formfield[employeeName]

Returns: name, type, value/checked, enabled, editable (based on protection + enabled state).

View Output

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]

Notes

  • Use document protection mode forms to make only form fields editable: officecli set report.docx / --prop protection=forms
  • Access by name (/formfield[employeeName]) or by index (/formfield[1]).

See Also


Based on OfficeCLI v1.0.64

Clone this wiki locally