-
Notifications
You must be signed in to change notification settings - Fork 610
word ptab
goworm edited this page Jun 26, 2026
·
1 revision
Inline positional tab (w:ptab, Word 2007+) — anchors left, center, or right alignment regions, typically in headers and footers.
Path: /body/p[@paraId=X]/r[N]
- add - Insert a positional tab into a paragraph
- set - Change an existing positional tab's attributes
- get - Read a positional tab's attributes
- query - Find positional tabs
- remove - Delete a positional tab
Parent: paragraph
| Property | Required/Default | Description |
|---|---|---|
align |
required | Alignment region: left, center, or right. Aliases: alignment. |
relativeTo |
default margin
|
Reference frame for the tab: margin or indent. Aliases: relativeto. |
leader |
default none
|
Leader character filling the tab: none, dot, hyphen, middleDot, or underscore. |
Parent: paragraph
| Property | Required/Default | Description |
|---|---|---|
align |
Alignment region: left, center, or right. Aliases: alignment. |
|
relativeTo |
default margin
|
Reference frame for the tab: margin or indent. Aliases: relativeto. |
leader |
default none
|
Leader character filling the tab: none, dot, hyphen, middleDot, or underscore. |
| Attribute | Type | Description |
|---|---|---|
align |
enum | The ptab alignment attribute (left, center, or right). |
relativeTo |
enum | The ptab relativeTo attribute (margin or indent). |
leader |
enum | The ptab leader attribute (none, dot, hyphen, middleDot, or underscore). |
# Insert a center-aligned positional tab into a paragraph
officecli add report.docx "/body/p[@paraId=X]" --type ptab --prop align=center
# Insert a right-aligned positional tab
officecli add report.docx "/body/p[@paraId=X]" --type ptab --prop align=right
# Insert a positional tab relative to the margin with a dot leader
officecli add report.docx "/body/p[@paraId=X]" --type ptab \
--prop align=right \
--prop relativeTo=margin \
--prop leader=dot
# Insert a positional tab in a header paragraph
officecli add report.docx "/header[1]/p[1]" --type ptab --prop align=center
# Read a positional tab's attributes
officecli get report.docx "/body/p[@paraId=X]/r[N]"
# Change an existing positional tab's alignment
officecli set report.docx "/body/p[@paraId=X]/r[N]" --prop align=right
# Find all positional tabs
officecli query report.docx ptab
# Remove a positional tab
officecli remove report.docx "/body/p[@paraId=X]/r[N]"- A positional tab is inserted as
<w:r><w:ptab/></w:r>and is surfaced bygetastype=ptab. - The
ptabtype alias ispositionaltab. - Positional tabs are most useful in headers and footers, where they anchor left/center/right alignment regions across the page width.
- Positional tabs are also addressable in header and footer paragraphs via the
/header[N]/p[M]/r[K]and/footer[N]/p[M]/r[K]paths.
- Run - The inline run that contains a positional tab
- Paragraph - The parent element
- Header / Footer - Where positional tabs are most commonly used
- Word Reference - All Word elements
Based on OfficeCLI v1.0.119