Enum HorizontalAlignment

横向对齐

受支持的水平对齐类型的枚举。

如需调用枚举,您可以调用其父类、名称和属性。例如 DocumentApp.HorizontalAlignment.LEFT

使用 HorizontalAlignment 枚举来操控 Paragraph 内容的对齐方式。

const body =     DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();  // Insert a paragraph and a table at the start of the tab. const par1 = body.insertParagraph(0, 'Center'); const table = body.insertTable(1, [['Left', 'Right']]); const par2 = table.getCell(0, 0).getChild(0).asParagraph(); const 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);

属性

属性类型说明
LEFTEnum“左对齐”选项。
CENTEREnum居中对齐选项。
RIGHTEnum右对齐选项。
JUSTIFYEnumjustify-alignment 选项。