更新时间:2023-02-14 08:30:23
我可以像上面那样理解.如果我的理解是正确的,那么这个答案呢?请认为这只是几个可能的答案之一.
I could understand like above. If my understanding is correct, how about this answer? Please think of this as just one of several possible answers.
在运行脚本之前,请设置变量.
Before you run the script, please set the variables.
function myFunction() {
var copyPageNumbers = [5, 7, 9]; // Please set the page number. This is not the index. So the 1st page is 1.
var masterGoogleSlidesId = "###"; // Please set the master Google Slides ID.
var destinationGoogleSlidesId = "###"; // Please set the destination Google Slides ID.
var offset = 1;
var src = SlidesApp.openById(masterGoogleSlidesId);
var dst = SlidesApp.openById(destinationGoogleSlidesId);
var slides = src.getSlides();
var page = 0;
slides.forEach(function(slide, i) {
if (copyPageNumbers.indexOf(i + 1) != -1) {
dst.insertSlide(offset + page, slide);
page++;
}
});
}
function myFunction() {
var copyPageNumbers = [5, 7, 9]; // Please set the page number. This is not the index. So the 1st page is 1.
var masterGoogleSlidesId = "###"; // Please set the master Google Slides ID.
var destinationGoogleSlidesId = "###"; // Please set the destination Google Slides ID.
var offset = 1;
var src = SlidesApp.openById(masterGoogleSlidesId);
var dst = SlidesApp.openById(destinationGoogleSlidesId);
var slides = src.getSlides();
copyPageNumbers.forEach(function(p, i) {
dst.insertSlide(offset + i, slides[p - 1]);
});
}
var offset = 0
时,将从目标Google幻灯片的第一页复制Google幻灯片母版的5、7和9页.
var offset = 0
is used, the pages of 5, 7 and 9 of the master Google Slides are copied from 1st page in the destination Google Slides.