0

enter image description hereI'm trying to make a code that changes the color of text in a presentation, this needs to change the color in several textboxes, on every page of the presentation.

I tried to use this code that I got in this question:Google Slides API- How to change text color for all shapes of a certain color

   var presentation = SlidesApp.getActivePresentation();
   var slides = presentation.getSlides();
   for (let i = 0; i < slides.length; i++) {
      var elements = slides[i].getPageElements();
      for (let j = 0; j < elements.length; j++)
         if (elements[j].asShape().getText().getTextStyle().getForegroundColor().asRgbColor().asHexString() == '#000000')
            elements[j].asShape().getText().getTextStyle().setForegroundColor('#ff0000');

   }
} 

But it didn't work, the error appeared Exception: Object is not of type RgbColor. (line 7)

  • In order to confirm your current issue, can you provide the sample Google Slides for replicating your error of `Exception: Object is not of type RgbColor. (line 7)`? – Tanaike Jul 04 '22 at 23:29
  • I put the image link at the beginning of the question. It's basically like this, I can't share what I'm actually using because it's from a company, but it would be the text inside a box. – Isabela Gaiotto Jul 05 '22 at 13:58
  • Thank you for replying. I would like to support you. But, I have to apologize for my poor English skill, again. Unfortunately, I cannot still understand your question. But I would like to try to understand it. When I could correctly understand it, I would like to think of a solution. I would be grateful if you can forgive my poor English skill. – Tanaike Jul 05 '22 at 23:18

0 Answers0