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.
MIT License
1.32k stars 171 forks source link

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

Closed jmatthewpryor closed 4 months ago

jmatthewpryor commented 4 months ago

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

jmatthewpryor commented 4 months ago

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