这是我当前的代码:
var NAME = "My favorite images";
var deck = SlidesApp.openById("1DKsiDGX9wwRbgP9WH2IJL2-
b1u1Q6jjz0JbrrKd_Fl4 ");
/**
* Creates a single slide using the image from the given link;
* used directly by foreach(), hence the parameters are fixed.
*
* @param {Date} link A String object representing an image URL
* @param {Date} index The index into the array; unused (req'd by
forEach)
*/
function addImageSlide(imageUrl, index) {
var slide = deck.appendSlide(SlidesApp.PredefinedLayout.BODY);
var image = slide.insertImage(imageUrl);
var imgWidth = image.getWidth();
var imgHeight = image.getHeight();
var pageWidth = deck.getPageWidth();
var pageHeight = deck.getPageHeight();
var newX = pageWidth / 2. - imgWidth / 2.;
var newY = pageHeight / 2. - imgHeight / 2.;
image.setLeft(newX).setTop(newY);
}
/**
* The driver application features an array of image URLs, setting
of the
* main title & subtitle, and creation of individual slides for each
image.
*/
function main() {
var images = [
"http://www.google.com/services/images/phone-animation-
results_2x.png ",
"http://www.google.com/services/images/section-work-card-
img_2x.jpg ",
"http://gsuite.google.com/img/icons/product-lockup.png",
"http://gsuite.google.com/img/home-hero_2x.jpg"
];
var [title, subtitle] = deck.getSlides()[0].getPageElements();
title.asShape().getText().setText(NAME);
subtitle.asShape().getText().setText("");
images.forEach(addImageSlide);
}
我不断收到错误找不到方法appendSlide((class))
。(第 12 行,文件“代码”)我应该进行哪些更改才能插入图像的 URL,以便将它们插入现有的谷歌幻灯片模板中?