应用程序脚本文档似乎表明可以将表格从一张幻灯片复制到另一张幻灯片 - 但我似乎无法让它工作。这是我使用过的脚本 - 对我做错了什么有什么想法吗?这是“使用”中示例的链接。
* @OnlyCurrentDoc
*/
/*
Instructions copied from https://developers.google.com/apps-script/reference/slides/slide#insertShape(ShapeType)
// Copy a table between presentations.
var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0];
var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0];
var table = otherPresentationSlide.getTables[0];
currentPresentationSlide.insertTable(table); // Also available for Layout, Master, and Page.*/
function test(){
var slide2 = SlidesApp.getActivePresentation().getSlides()[1];
var table = SlidesApp.getActivePresentation.getPageElementById('g2c6eee07fad_0_0').asTable();
slide2.insertTable(table);
在您的演示脚本中,进行以下修改如何?
从:
到:
SlidesApp.getActivePresentation
修改为SlidesApp.getActivePresentation()
.但是,在这种情况下,我认为
SlidesApp.getActivePresentation()
可以将其声明为变量,如下所示。或者,如果您想将第一页中的表格复制到第二页,可以使用以下修改。