google-apps-script - GoogleAppsScript | setPictureFill 在 Google 幻灯片中不起作用
问题描述
这是我的代码。我试图在 GoogleSlides 中通过 URL 设置背景,但是当我运行代码时,Google 返回TypeError: The setPictureFill function can not be found in the Page object。
var slide = SlidesApp.getActivePresentation().getSelection().getCurrentPage();
var img = 'https://media.giphy.com/media/9bTjZrytydVRK/giphy.gif';
slide.setPictureFill(img);
解决方案
在您的代码slide
中是页面对象,但page
对象没有setPictureFill()
方法;因此出现错误。你需要的是一个PageBackground
对象。尝试以下操作:
function my_fill() {
var slide = SlidesApp.getActivePresentation().getSelection().getCurrentPage();
var page_background = slide.getBackground();
var img = 'https://media.giphy.com/media/9bTjZrytydVRK/giphy.gif';
page_background.setPictureFill(img);
}
它成功地将动画空间 GIF 作为背景。
推荐阅读
- javascript - 如何从用户选择的选项绑定到 Angular 表单
- reactjs - 如何在反应中映射嵌套数组
- javascript - 如何在数组列表中对具有相同名称的元素进行分组?
- python - 如何获取 seaborn distplot 中分布峰值 y 值的 X 轴值?
- html - 如何从 Angular 向 node.js 发送一个数字
- python - 将字符串索引更改为整数
- python - 如何连接文件夹中多个图像中的 5 个图像
- r - 你能垂直翻转一个闪亮的仪表吗?
- reactjs - 如何使用 REST API 获取 woocommerce 购物车项目?
- java - 使用 Jsoup 从原始数据中解析纯文本数据