sei*_*cle 2 arrays google-apps-script google-slides
我需要使用 Google Apps 脚本,而不是 API。
-> 我想删除这张空幻灯片,以便演示文稿仅包含我粘贴到其中的幻灯片。
我的代码:
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();
Run Code Online (Sandbox Code Playgroud)
你需要remove到Slide. pop()只是将其从数组中删除并返回Slide [].
var lastSlide=presentation.getSlides().pop();
lastSlide.remove();
Run Code Online (Sandbox Code Playgroud)