创建并打开可修改的 Presentations。
// Open a presentation by ID. let preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE'); // Create and open a presentation. preso = SlidesApp.create('Presentation Name');
属性
| 属性 | 类型 | 说明 |
|---|---|---|
Alignment | Alignment | 对齐位置类型的枚举。 |
Arrow | Arrow | 一个枚举,包含 Line 可采用的不同箭头样式。 |
Auto | Auto | 自动文本类型的枚举。 |
Autofit | Autofit | 自动调整类型的枚举。 |
Cell | Cell | 表格单元格的不同合并状态的枚举。 |
Color | Color | 颜色类型的枚举。 |
Content | Content | 用于指定内容对齐方式的值的枚举。 |
Dash | Dash | Line 可以采用的不同虚线样式的枚举。 |
Fill | Fill | 填充类型的枚举。 |
Line | Line | Line 的类别枚举。 |
Line | Line | Line 类型的枚举。 |
Line | Line | Line 类型的枚举。 |
Link | Link | 链接类型的枚举。 |
List | List | 列表预设类型的枚举。 |
Page | Page | 页面背景类型的枚举。 |
Page | Page | 页面元素类型的枚举。 |
Page | Page | 页面类型的枚举。 |
Paragraph | Paragraph | 段落对齐方式的枚举。 |
Placeholder | Placeholder | 占位符类型的枚举。 |
Predefined | Predefined | 预定义布局的枚举。 |
Selection | Selection | 选择类型的枚举。 |
Shape | Shape | 形状类型的枚举。 |
Sheets | Sheets | Google 表格图表嵌入类型的枚举。 |
Slide | Slide | 一个枚举,用于表示 Google 幻灯片的关联方式。 |
Slide | Slide | 幻灯片位置类型的枚举。 |
Spacing | Spacing | 间距模式类型的枚举。 |
Text | Text | 文本基线偏移类型的枚举。 |
Text | Text | 文本方向类型的枚举。 |
Theme | Theme | 主题颜色的枚举。 |
Video | Video | 视频源类型的枚举。 |
方法
| 方法 | 返回类型 | 简介 |
|---|---|---|
create(name) | Presentation | 创建并打开新的 Presentation。 |
get | Presentation|null | 返回脚本所绑定到的容器的当前活跃演示,如果没有活跃演示,则返回 null。 |
get | Ui | 返回演示文稿的用户界面环境的实例,该实例允许脚本添加菜单、对话框和边栏等功能。 |
new | Affine | 返回新的 Affine 以构建 Affine。 |
open | Presentation | 打开具有指定 ID 的 Presentation。 |
open | Presentation | 使用给定的网址打开 Presentation。 |
详细文档
create(name)
创建并打开新的 Presentation。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
name | String | 要为创建的演示文稿指定的名称。 |
返回
Presentation - 具有指定名称的演示。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations
get Active Presentation()
返回脚本所绑定到的容器的当前活跃演示,如果没有活跃演示,则返回 null。如需与未绑定到容器的演示文稿进行互动,请改用 open。
// Get the current presentation to which this script is bound. const presentation = SlidesApp.getActivePresentation();
返回
Presentation|null
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Ui()
返回演示文稿的用户界面环境的实例,该实例允许脚本添加菜单、对话框和边栏等功能。脚本只能与打开的演示文稿的当前实例的界面互动,并且只有在脚本绑定到演示文稿时才能进行互动。如需了解详情,请参阅菜单和对话框和边栏指南。
// Add a custom menu to the active presentation, including a separator and a // sub-menu. function onOpen(e) { SlidesApp.getUi() .createMenu('My Menu') .addItem('My menu item', 'myFunction') .addSeparator() .addSubMenu( SlidesApp.getUi() .createMenu('My sub-menu') .addItem('One sub-menu item', 'mySecondFunction') .addItem('Another sub-menu item', 'myThirdFunction'), ) .addToUi(); }
返回
new Affine Transform Builder()
open By Id(id)
打开具有指定 ID 的 Presentation。
// Open a presentation by ID. const presentation = SlidesApp.openById('docId');
参数
| 名称 | 类型 | 说明 |
|---|---|---|
id | String |
返回
Presentation - 具有指定 ID 的演示
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations
open By Url(url)
使用给定的网址打开 Presentation。
// Open a presentation by URL. const presentation = SlidesApp.openByUrl( 'https://docs.google.com/presentation/d/docId/edit', );
参数
| 名称 | 类型 | 说明 |
|---|---|---|
url | String |
返回
Presentation - 具有指定网址的演示文稿
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations