创建并打开可以修改的Presentations
。
// Open a presentation by ID. var preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE'); // Create and open a presentation. preso = SlidesApp.create('Presentation Name');
属性
媒体资源 | 类型 | 说明 |
---|---|---|
AlignmentPosition | AlignmentPosition | 枚举各种对齐位置类型。 |
ArrowStyle | ArrowStyle | 枚举 Line 可以具有的不同箭头样式。 |
AutoTextType | AutoTextType | 枚举自动文本类型的枚举。 |
AutofitType | AutofitType | 自动调整类型的枚举。 |
CellMergeState | CellMergeState | 枚举表格单元格的不同合并状态。 |
ColorType | ColorType | 颜色类型的枚举。 |
ContentAlignment | ContentAlignment | 用于指定内容对齐方式的值枚举。 |
DashStyle | DashStyle | 枚举 Line 可以采用的不同短划线样式。 |
FillType | FillType | 填充类型的枚举。 |
LineCategory | LineCategory | 对 Line 的类别的枚举。 |
LineFillType | LineFillType | 对 LineFill 类型的枚举。 |
LineType | LineType | 对 Line 类型的枚举。 |
LinkType | LinkType | 对链接类型的枚举。 |
ListPreset | ListPreset | 枚举列表预设类型。 |
PageBackgroundType | PageBackgroundType | 枚举各种页面背景类型。 |
PageElementType | PageElementType | 枚举各种页面元素。 |
PageType | PageType | 对页面类型的枚举。 |
ParagraphAlignment | ParagraphAlignment | 枚举各种段落对齐方式。 |
PlaceholderType | PlaceholderType | 枚举各种占位符类型。 |
PredefinedLayout | PredefinedLayout | 对预定义布局的枚举。 |
SelectionType | SelectionType | 枚举选择类型。 |
ShapeType | ShapeType | 对形状类型的枚举。 |
SheetsChartEmbedType | SheetsChartEmbedType | 枚举 Google 表格图表嵌入类型。 |
SlideLinkingMode | SlideLinkingMode | 枚举链接幻灯片的方式。 |
SlidePosition | SlidePosition | 枚举幻灯片位置类型。 |
SpacingMode | SpacingMode | 枚举各种间距模式类型。 |
TextBaselineOffset | TextBaselineOffset | 枚举文本基线偏移量的类型。 |
TextDirection | TextDirection | 文本路线类型的枚举。 |
ThemeColorType | ThemeColorType | 主题颜色枚举。 |
VideoSourceType | VideoSourceType | 一个枚举,表示视频来源的类型。 |
方法
方法 | 返回类型 | 简介 |
---|---|---|
create(name) | Presentation | 创建并打开新的 Presentation 。 |
getActivePresentation() | Presentation | 返回脚本绑定至容器的当前活动展示内容,如果没有活动展示内容,则返回 null 。 |
getUi() | Ui | 返回一个演示文稿界面环境实例,允许脚本添加菜单、对话框和边栏等功能。 |
newAffineTransformBuilder() | AffineTransformBuilder | 返回新的 AffineTransformBuilder 以构建 AffineTransform 。 |
openById(id) | Presentation | 打开具有指定 ID 的 Presentation 。 |
openByUrl(url) | Presentation | 使用指定的网址打开 Presentation 。 |
详细文档
create(name)
创建并打开新的 Presentation
。
参数
名称 | 类型 | 说明 |
---|---|---|
name | String | 要为已创建的演示文稿指定的名称。 |
弃踢回攻
Presentation
- 具有指定名称的演示文稿。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations
getActivePresentation()
返回脚本绑定至容器的当前活动展示内容,如果没有活动展示内容,则返回 null
。如需与脚本未绑定至容器的演示文稿交互,请改用 openById(id)
。
// Get the current presentation to which this script is bound. var presentation = SlidesApp.getActivePresentation();如果演示文稿已打开,则返回相同的演示文稿实例。
弃踢回攻
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getUi()
返回一个演示文稿界面环境实例,允许脚本添加菜单、对话框和边栏等功能。只有在已打开演示文稿的当前实例中,并且脚本已绑定到演示文稿时,脚本才可以与界面交互。如需了解详情,请参阅菜单以及对话框和边栏指南。
// 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(); }
弃踢回攻
newAffineTransformBuilder()
openById(id)
打开具有指定 ID 的 Presentation
。
// Open a presentation by ID. var presentation = SlidesApp.openById('docId');如果演示文稿已打开,则返回相同的演示文稿实例。
参数
名称 | 类型 | 说明 |
---|---|---|
id | String |
弃踢回攻
Presentation
- 具有指定 ID 的演示文稿
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations
openByUrl(url)
使用给定的网址打开 Presentation
。
// Open a presentation by URL. var presentation = SlidesApp.openByUrl('https://docs.google.com/presentation/d/docId/edit');如果演示文稿已打开,则返回相同的演示文稿实例。
参数
名称 | 类型 | 说明 |
---|---|---|
url | String |
弃踢回攻
Presentation
- 具有指定网址的演示文稿
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations