Google Apps Script

Enum HorizontalAlignment

An enumeration of the supported horizontal alignment types.

Use the HorizontalAlignment enumeration to manipulate the alignment of Paragraph contents.

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.

 // Left align the first cell.

 // Right align the second cell.


LEFTEnumThe left-alignment option.
CENTEREnumThe center-alignment option.
RIGHTEnumThe right-alignment option.
JUSTIFYEnumThe justify-alignment option.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.