Skip to main content
Control paragraph and heading alignment for professional document layouts. Perfect Word import/export compatibility for all alignment options.

OOXML Structure

<w:p>
  <w:pPr>
    <w:jc w:val="center"/>
  </w:pPr>
  <w:r>
    <w:t>Centered text</w:t>
  </w:r>
</w:p>

Use Case

  • Titles & Headings - Center important headings for emphasis
  • Quotes - Right-align attributions or center block quotes
  • Formal Documents - Justify body text for professional appearance
  • Letters - Right-align dates and signatures
  • Poetry - Center verses for artistic presentation

Options

Configure the extension behavior:
types
Array<string>
default:"['heading','paragraph']"
Node types to apply alignment to
alignments
Array<string>
default:"['left','center','right','justify']"
Available alignment options
defaultAlignment
string
default:"left"
Default text alignment

Attributes

Node attributes that can be set and retrieved:
textAlign
string
default:"left"
Text alignment value (left, center, right, justify)

Commands

setTextAlign

Set text alignment
Applies to all configured node types (heading, paragraph by default)
Example:
editor.commands.setTextAlign('center')
editor.commands.setTextAlign('justify')
Parameters:
alignment
string
required
Alignment value (left, center, right, justify)

unsetTextAlign

Remove text alignment (reset to default)
Resets alignment to the default value
Example:
editor.commands.unsetTextAlign()

Keyboard Shortcuts

CommandShortcutDescription
setTextAlign(‘left’)()⌘/Ctrl-Shift-lAlign text left
setTextAlign(‘center’)()⌘/Ctrl-Shift-eAlign text center
setTextAlign(‘right’)()⌘/Ctrl-Shift-rAlign text right
setTextAlign(‘justify’)()⌘/Ctrl-Shift-jJustify text

Source Code