There are many ways to insert images to a table cell in Google Docs/Sheets, but how about Google Slides?
I used Google Apps Script and found that appendImage
function is not in TableCell
object: 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);
}
And I used Google Slides API, I can't create an image inside the table cell.
Please help me to solve this problem. Thanks!
You cannot insert image to table cell via Slides API.
From https://developers.google.com/slides/api/guides/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.
So image can be inserted as a direct child of a slide only.