Skip to main content
Insert automatic page numbers in headers and footers. Dynamic page numbering that updates as document changes, with total page count support.

OOXML Structure

<!-- Page number field -->
<w:fldSimple w:instr="PAGE">
  <w:r>
    <w:t>1</w:t>
  </w:r>
</w:fldSimple>

<!-- Total pages field -->
<w:fldSimple w:instr="NUMPAGES">
  <w:r>
    <w:t>10</w:t>
  </w:r>
</w:fldSimple>

Use Case

  • Professional documents - Standard page numbering
  • Reports - Page X of Y format
  • Legal documents - Required pagination
  • Print layouts - Automatic page tracking
  • Dynamic updates - Numbers adjust as content changes

Options

Configure the extension behavior:
htmlAttributes
Object
HTML attributes for page number elements

Commands

addAutoPageNumber

Insert an automatic page number
Only works in header/footer contexts
Example:
editor.commands.addAutoPageNumber()
Returns: Function Command function

addTotalPageCount

Insert total page count
Only works in header/footer contexts
Example:
editor.commands.addTotalPageCount()
Returns: Function Command function

Keyboard Shortcuts

CommandShortcutDescription
addAutoPageNumber()⌘/Ctrl-Shift-alt-pInsert page number

Source Code

I