Skip to content

word document set

zmworm edited this page Mar 31, 2026 · 24 revisions

Word: Document - set

Set document-level metadata and page setup properties.

Path: /

Properties

Property Accepted Values Description
title text Document title
author / creator text Author name
subject text Subject
keywords text Keywords
description text Description
category text Category
lastModifiedBy text Last modifier
revision text Revision number
defaultFont font name Default document font
pageBackground / background hex color Page background
pageWidth integer (twips) Page width
pageHeight integer (twips) Page height
marginTop integer (twips) Top margin
marginBottom integer (twips) Bottom margin
marginLeft integer (twips) Left margin
marginRight integer (twips) Right margin

| protection | readOnly, comments, trackedChanges, forms, none | Document protection mode | | accept-changes | all | Accept all tracked changes | | reject-changes | all | Reject all tracked changes | | find | text | Search text (used with replace) | | replace | text | Replacement text | | scope | all (default), body, headers, footers | Find/replace scope |

Examples

officecli set report.docx / --prop title="Annual Report" --prop author="Finance Team"
officecli set report.docx / --prop pageWidth=12240 --prop pageHeight=15840
officecli set report.docx / --prop marginTop=1440 --prop marginBottom=1440
officecli set report.docx / --prop defaultFont="Times New Roman"

# Find and replace text throughout the document
officecli set report.docx / --prop find="2024" --prop replace="2025"

# Find and replace only in the body (excluding headers/footers)
officecli set report.docx / --prop find="Draft" --prop replace="Final" --prop scope=body

# Find and replace only in headers and footers
officecli set report.docx / --prop find="CONFIDENTIAL" --prop replace="PUBLIC" --prop scope=headers

# Protect document (only form fields editable)
officecli set report.docx / --prop protection=forms

# Remove protection
officecli set report.docx / --prop protection=none

Note: Batch set via selector path is also supported: officecli set doc.docx 'paragraph[style=Heading1]' --prop font=Arial

See also: Form Field for creating and filling text/checkbox/dropdown form fields.


Based on OfficeCLI v1.0.28

Clone this wiki locally