Skip to content

word ptab

goworm edited this page Jun 26, 2026 · 1 revision

Word: Positional Tab

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]

Operations

  • 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

add

Parent: paragraph

Properties

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.

set

Parent: paragraph

Properties

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.

get Attributes

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).

Examples

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

Notes

  • A positional tab is inserted as <w:r><w:ptab/></w:r> and is surfaced by get as type=ptab.
  • The ptab type alias is positionaltab.
  • 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.

See Also


Based on OfficeCLI v1.0.119

Clone this wiki locally