Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Word.Alignment enum
- Package:
- word
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
await Word.run(async (context) => {
const body: Word.Body = context.document.body;
body.clear();
body.insertParagraph(
"Do you want to create a solution that extends the functionality of Word? You can use the Office Add-ins platform to extend Word clients running on the web, on a Windows desktop, or on a Mac.",
"Start"
);
body.paragraphs
.getLast()
.insertText(
"Use add-in commands to extend the Word UI and launch task panes that run JavaScript that interacts with the content in a Word document. Any code that you can run in a browser can run in a Word add-in. Add-ins that interact with content in a Word document create requests to act on Word objects and synchronize object state.",
"Replace"
);
body.paragraphs.getFirst().alignment = "Left";
body.paragraphs.getLast().alignment = Word.Alignment.left;
});
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. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
Was this page helpful?
