-
Notifications
You must be signed in to change notification settings - Fork 541
word section set
zmworm edited this page Apr 9, 2026
·
52 revisions
Modify section page layout, orientation, and margins.
Path: /section[N]
| Property | Accepted Values | Description |
|---|---|---|
type |
continuous, evenPage/even, oddPage/odd, nextPage/next
|
Break type. Invalid values throw an error. |
pageWidth |
twips or units (cm, in, pt) |
Width (e.g., 21cm, 8.5in) |
pageHeight |
twips or units (cm, in, pt) |
Height (e.g., 29.7cm, 11in) |
orientation |
landscape, portrait
|
Orientation. Setting landscape auto-swaps width/height if misaligned. |
marginTop/Bottom/Left/Right |
twips | Margins |
columns/cols/col
|
"3" or "3,720"
|
Column count, or count with space (twips) |
colWidths |
alternating values | Custom column widths: "width,space,width,space,..." (twips) |
separator/sep
|
bool | Line between columns |
Note: Get returns pageWidth and pageHeight as unit-qualified cm strings (e.g., "21cm", "29.7cm").
# Set landscape with twips
officecli set report.docx /section[2] --prop orientation=landscape --prop pageWidth=15840 --prop pageHeight=12240
# Set A4 with unit suffixes
officecli set report.docx /section[1] --prop pageWidth=21cm --prop pageHeight=29.7cm
# Set US Letter with inches
officecli set report.docx /section[1] --prop pageWidth=8.5in --prop pageHeight=11in
# Set 3 equal columns
officecli set report.docx /section[1] --prop columns=3
# Set 3 columns with custom spacing (720 twips)
officecli set report.docx /section[1] --prop cols="3,720"
# Set custom column widths with spacing
officecli set report.docx /section[1] --prop colWidths="3000,720,2000,720,3000"
# Add separator line between columns
officecli set report.docx /section[1] --prop columns=2 --prop separator=trueBased on OfficeCLI v1.0.40