I am trying to create a table and have it end up being centered in the document body of a Google DocumentApp using Google Script.
As of now, I create Tables using a For Loop and they are created fine, they Just will not center.
I have tried the Following:
Attempt 1:
var insertedTable = updateBody.insertTable(numberOfTables, objectivesTables[g]);
insertedTable.setAlignment(DocumentApp.HorizontalAlignment.CENTER);
RESULT: This makes one LEFT aligned table then stalls and times out. (I am using a library that I have created and I am calling this function from another Script so I do not get an error message)
Attempt 2:
var style = {};
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.CENTER;
updateBody.insertTable(numberOfTables, objectivesTables[g]).setAttributes(style);
RESULT: All Tables Are created but are Left Aligned.
I have seen this done with Text, Paragraphs, and Images but I cannot figure out how to accomplish this with a Table so any help would be graciously received.