Google Apps 脚本 - 在 Google 幻灯片中插入图像 Table

Google Apps Script - Insert image in a Google Slides Table

在 Google Docs/Sheets 的 table 单元格中插入图像的方法有很多种,但是 Google 幻灯片呢?

我使用了 Google Apps 脚本,发现 appendImage 函数不在 TableCell 对象中:Class TableCell of google apps scripts

var NAME = "Test slide 2018/7/3";
var deck = SlidesApp.create(NAME);

function addImageSlide(link,index) {
  var slide = deck.appendSlide(SlidesApp.PredefinedLayout.BLANK);
//  var image = slide.insertImage(link);
  var table = slide.insertTable(3, 4)
  var cell = table.getCell(0,0)
  cell.appendImage(link);
}

function main(){
  var images = [
    "https://thehousenewsbloggers.files.wordpress.com/2016/12/440_4079.jpg",
    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRMKzX5vtY5jMcBI3OQgv6LUNbd5uJZXiVhSozd_cyg9Fl2tPWC",
  ];
  var [title, subtitle] = deck.getSlides()[0].getPageElements();
  title.asShape().getText().setText(NAME);
  subtitle.asShape().getText().setText("Google Apps Script\nSlides Service demo")
  images.forEach(addImageSlide);
}

而且我使用了 Google 幻灯片 API,我无法在 table 单元格内创建图像。

请帮我解决这个问题。谢谢!

简答

您无法通过幻灯片 API 向 table 单元格插入图像 API。

说明

来自https://developers.google.com/slides/how-tos/add-image

Images in the Slides API are a type of page element. As with any page element, you specify the visual size and position of the image using the size and transform properties of the PageElement.

因此图片只能作为幻灯片的直接子项插入。