创建并打开可修改的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