Enum TextAlignment
TextAlignment
An enumeration of the type of text alignments.
To call an enum, you call its parent class, name, and property. For example,
DocumentApp.TextAlignment.NORMAL
.
// Make the first character in the first paragraph of the active tab be
// superscript.
const documentTab =
DocumentApp.getActiveDocument().getActiveTab().asDocumentTab();
const text = documentTab.getBody().getParagraphs()[0].editAsText();
text.setTextAlignment(0, 0, DocumentApp.TextAlignment.SUPERSCRIPT);
Properties
Property | Type | Description |
NORMAL | Enum | The normal text alignment. |
SUPERSCRIPT | Enum | The superscript text alignment. |
SUBSCRIPT | Enum | The subscript text alignment. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-26 UTC.
[null,null,["Last updated 2024-11-26 UTC."],[[["TextAlignment is used to set the alignment of text, such as normal, superscript, or subscript."],["You can access TextAlignment properties using `DocumentApp.TextAlignment` followed by the specific property like `NORMAL` or `SUPERSCRIPT`."],["The provided code snippet demonstrates how to apply superscript alignment to the first character of a paragraph."]]],[]]