Align a line or a paragraph
Apply paragraph alignment at the current selection through the Formatting service. Alignment belongs to the document block rather than the native toolbar layout.
Use the selection and state APIs when your application provides its own formatting controls.

Use it in your application
Place the caret in the intended paragraph, or select the paragraphs to format, before applying alignment.
Await each operation. Paragraph alignment requires editable Design mode. Source mode supports its own limited inline tag operations; switch to Design before aligning paragraphs.
Use StateQuery to update an application-owned alignment indicator from the actual current view.
await editor.Formatting.AlignCenterAsync();
bool centered = await editor.StateQuery.IsJustifyCenterAsync();