枚举受支持的水平对齐类型。
若要调用枚举,您可以调用其父类、名称和属性。例如
DocumentApp.HorizontalAlignment.LEFT
。
使用 HorizontalAlignment
枚举来操纵 Paragraph
内容的对齐方式。
var body = DocumentApp.getActiveDocument().getBody(); // Insert a paragraph and a table at the start of document. var par1 = body.insertParagraph(0, "Center"); var table = body.insertTable(1, [['Left', 'Right']]); var par2 = table.getCell(0, 0).getChild(0).asParagraph(); var par3 = table.getCell(0, 0).getChild(0).asParagraph(); // Center align the first paragraph. par1.setAlignment(DocumentApp.HorizontalAlignment.CENTER); // Left align the first cell. par2.setAlignment(DocumentApp.HorizontalAlignment.LEFT); // Right align the second cell. par3.setAlignment(DocumentApp.HorizontalAlignment.RIGHT);
属性
媒体资源 | 类型 | 说明 |
---|---|---|
LEFT | Enum | 左对齐选项。 |
CENTER | Enum | 居中对齐选项。 |
RIGHT | Enum | 右对齐选项。 |
JUSTIFY | Enum | Justify-alignment 选项。 |