enuchi / React-Google-Apps-Script

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript support for TableCell.setBold() TableCell.setFontSize()

jmatthewpryor opened this issue · comments

When I use TypeScript support, I get errors about missing functions on the Document API

It seems like gas-types-detailed does not define TableCell.setBold() and TableCell.setFontSize()

Are there workarounds? It is very helpful to have the type checking of TypeScript

If I stay in JavaScript and compile and deploy, those functions both work in the deployed code

Answering my own question, turns out that I need to use setAttributes() e.g.

  var styleFont10 = {};
  styleFont10[DocumentApp.Attribute.FONT_SIZE] = 10;
    
  cell1.setBackgroundColor('#dddddd').setAttributes(styleFont10); // Set font size and other properties