Enum HorizontalAlignment

HorizontalAlignment

此屬性列舉了支援的水平對齊類型。

如要呼叫列舉,您可以呼叫其父項類別、名稱和屬性。例如 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);

屬性

屬性類型說明
LEFTEnum靠左對齊選項。
CENTEREnum置中對齊選項。
RIGHTEnum靠右對齊選項。
JUSTIFYEnum左右對齊選項。