There seems to be a bug in the code when changing the width of lines using apps script

28 Views Asked by At

Using Logger.log to find the width of a line returns a number, 0.75 in my case. Logger.log(SlidesApp.getActivePresentation().getPageElementById('g2b1b713b937_0_0').asLine().getWeight());

When that code is adjusted to set the weight of the line I get an erorr message I can't account for. SlidesApp.getActivePresentation().getPageElementById('g2b1b713b937_0_0').asLine().getWeight().setWeight(2);

.setWeight is not a function

1

There are 1 best solutions below

1
TheWizEd On BEST ANSWER

The problem with your code is

SlidesApp.getActivePresentation().getPageElementById('g2b1b713b937_0_0').asLine().getWeight()

Returns a number so chaining .setWeight() will return an error because there is no .setWeight() methof of Number.

I believe what you want to do is

SlidesApp.getActivePresentation().getPageElementById('g2b1b713b937_0_0').asLine().setWeight(2);