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:
alignments
Array<string>
default:"['left','center','right','justify']"
Available alignment options

Commands

setTextAlign

Set text alignment on the current paragraph. 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