Enum HorizontalAlignment

HorizontalAlignment

Énumération des types d'alignements horizontaux acceptés.

Pour appeler une énumération, vous devez appeler sa classe parente, son nom et sa propriété. Par exemple, DocumentApp.HorizontalAlignment.LEFT.

Utilisez l'énumération HorizontalAlignment pour manipuler l'alignement des contenus 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);

Propriétés

PropriétéTypeDescription
LEFTEnumOption d'alignement à gauche.
CENTEREnumOption d'alignement au centre.
RIGHTEnumOption d'alignement à droite.
JUSTIFYEnumOption de justification de l'alignement.