style table cells, particular borders and cell text alignment

286 views
Skip to first unread message

Frédéric Alesch

unread,
Oct 17, 2022, 8:08:46 AM10/17/22
to Google Apps Script Community
Hi friends,

how can I style the border of a table via Google AppScript. I happen to use this API (found in some tutorials) to style the table but I cannot figure out how to style the table.

headerStyle[DocumentApp.Attribute.BACKGROUND_COLOR] = '#FFFFFF'; headerStyle[DocumentApp.Attribute.BOLD] = true; headerStyle[DocumentApp.Attribute.FOREGROUND_COLOR] = '#000000';
td.setAttributes(headerStyle);

I want to change the border width and color, but not all borders everywhere, just some (top, left, right of the header, bottom, left, right of the lowest row). Allegedly it's not possible, one can only style the entire table, not specific cells. Anyways, thought I ask, just in case.

Also, I want to change the text alignment in the cells.
Is that doable? My guess is yes
I tried to do

td.setAlignment(DocumentApp.HorizontalAlignment.RIGHT);

but it throws an error TypeError: td.setAlignment is not a function

thanks for help

Tanaike

unread,
Oct 17, 2022, 11:30:41 PM10/17/22
to Google Apps Script Community
I think that in order to manage each border in a table using Google Apps Script, in the current stage, it is required to use Google Docs API. So, in your situation, I thought that these threads might be useful. But, if those were not useful, I apologize.

Reply all
Reply to author
Forward
0 new messages