Word.Alignment enum
Represents the horizontal alignment of text.
Remarks
Used by
- Word.List: setLevelAlignment
- Word.ListLevel: alignment
- Word.Paragraph: alignment
- Word.ParagraphFormat: alignment
- Word.Table: alignment, horizontalAlignment
- Word.TableCell: horizontalAlignment
- Word.TableRow: horizontalAlignment
- Word.TableStyle: alignment
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/paragraph-properties.yaml
// Centers the last paragraph between the document margins.
await Word.run(async (context) => {
const lastParagraph: Word.Paragraph = context.document.body.paragraphs.getLast();
const alignment: Word.Alignment = Word.Alignment.centered;
lastParagraph.alignment = alignment;
await context.sync();
});
Fields
| centered = "Centered" | Alignment to the center. |
| justified = "Justified" | Fully justified alignment. |
| left = "Left" | Alignment to the left. |
| mixed = "Mixed" | Mixed horizontal alignment. |
| right = "Right" | Alignment to the right. |
| unknown = "Unknown" | Unknown alignment. |