Sarath
Sarath

Reputation: 67

How set Indentation to Google slide Shape Text

We are trying to Indent the Google Slide Shape, by setting the Left/Right indentation values using Google Apps Script.

function indentShape(){
  var slide = SlidesApp.getActivePresentation().getSlides()[0];
  var shape = slide.getShapes()[0];

  // shape.setIndent(Left,Right) 
  shape.setIndent(10,20)
}

Upvotes: 0

Views: 271

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

  1. setIndent() is a method belonging to the XML script service but not Slides Script Service. https://developers.google.com/apps-script/reference/xml-service/format
  2. The Slides Script features the methods setIndentStart(indent), setIndentFirstLine(indent) and setIndentEnd(indent) https://developers.google.com/apps-script/reference/slides/paragraph-style#getIndentStart().
  3. Here an example how to use those methods:
    shape.getText().getParagraphStyle().setIndentStart(20)

Upvotes: 2

Related Questions