我在Google工作表文档中有一堆网址,我想在我当前的代码中引用它们,然后将它们插入到Google幻灯片演示文稿中。
这是我目前的代码:
var NAME = ("Price Changes, Earnings Revisions and F-GPE");
var deck = SlidesApp.openById("1dKURl3umVd3A6M5fbbm1SY1W-NzaaCNW-5rPtTKuNYw");
var layoutslide = SlidesApp.openById("1dKURl3umVd3A6M5fbbm1SY1W-NzaaCNW-5rPtTKuNYw").getSlides()[2];
var layout = layoutslide.getLayout();
//var layoutname = layout.getLayoutName();
/**
* 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)
* Sets the desired images height and width
* Gets the images's height and width and centres the image
*/
function addImageSlide(imageUrl, index) {
var layout = layoutslide.getLayout();
//var layoutname = layout.getLayoutName();
var slide = deck.appendSlide(layout);
var image = slide.insertImage(imageUrl);
var setimgwdth = image.setWidth(700);
var setimghght = image.setHeight(430);
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 = [
"https://product.datastream.com/dscharting/gateway.aspx?guid=a82ade99-e810-463e-9b21-8380971a7488&action=REFRESH" ,
"https://product.datastream.com/dscharting/gateway.aspx?guid=933e1953-fd5b-48d0-b9f5-28e9e6c5e01a&action=REFRESH" ,
"https://product.datastream.com/dscharting/gateway.aspx?guid=9caf2c27-f5f3-4dfe-a784-3e964504dc03&action=REFRESH"
];
var [title, subtitle] = deck.getSlides()[0].getPageElements();
title.asShape().getText().setText("Price Changes, Earnings Revisions and F-GPE");
subtitle.asShape().getText().setText("SA INSPIRATION LIST");
images.forEach(addImageSlide);
}
是否还可以自动为网址添加引号和逗号。