2

I need to use Google Apps Script, not the API.

  • I create an empty presentation
  • It seems newly created presentations always contains an empty slide by default
  • I insert a slide (taken from an other prez) into the presentation.

-> I'd like to delete this empty slide, so that the presentation contains only the slide I paste into it.

The code I have:

var presentation = SlidesApp.create("my new presentation"); // creates an empty slide in the prez
presentation.insertSlide(0,slides.pop()); // a slide from a deck of slides collected elsewhere
presentation.getSlides().pop(); // here trying to delete the empty slide, doesn't work: the slide remains in the presentation.
presentation.saveAndClose();
4

1 回答 1

4

您需要removeSlide. pop()只需将其从数组中删除并返回Slide [].

var lastSlide=presentation.getSlides().pop(); 
lastSlide.remove();
于 2018-10-14T20:27:40.713 回答