I have some code I am using for a google apps script macro. This uses the DocumentApp TableRow and Table Cell datatype.
//row is TableRow datatype
function appendRow(row){
var style = {};
style[DocumentApp.Attribute.FONT_SIZE] = '8';
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT;
row.appendTableCell(SOME_TEXT).setAttributes(style);
}
So when I run this function the resulting cell in the row is still the default left justified. Am I missing something? They have this example on their website.
https://developers.google.com/apps-script/reference/document/table-cell#setAttributes(Object)
var body = DocumentApp.getActiveDocument().getBody();
// Define a custom paragraph style.
var style = {};
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] =
DocumentApp.HorizontalAlignment.RIGHT;
style[DocumentApp.Attribute.FONT_FAMILY] = 'Calibri';
style[DocumentApp.Attribute.FONT_SIZE] = 18;
style[DocumentApp.Attribute.BOLD] = true;
// Append a plain paragraph.
var par = body.appendParagraph('A paragraph with custom style.');
// Apply the custom style.
par.setAttributes(style);
