Enum HorizontalAlignment

PerataanHorizontal

Enumerasi jenis perataan horizontal yang didukung.

Untuk memanggil enum, Anda memanggil class induk, nama, dan propertinya. Misalnya, DocumentApp.HorizontalAlignment.LEFT.

Gunakan enumerasi HorizontalAlignment untuk memanipulasi perataan konten 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);

Properti

PropertiJenisDeskripsi
LEFTEnumOpsi perataan kiri.
CENTEREnumOpsi perataan tengah.
RIGHTEnumOpsi perataan kanan.
JUSTIFYEnumOpsi perataan justify.