Class SlidesApp

SlidesApp

创建并打开可以修改的Presentations

// Open a presentation by ID.
var preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE');

// Create and open a presentation.
preso = SlidesApp.create('Presentation Name');

属性

媒体资源类型说明
AlignmentPositionAlignmentPosition枚举各种对齐位置类型。
ArrowStyleArrowStyle枚举 Line 可以具有的不同箭头样式。
AutoTextTypeAutoTextType枚举自动文本类型的枚举。
AutofitTypeAutofitType自动调整类型的枚举。
CellMergeStateCellMergeState枚举表格单元格的不同合并状态。
ColorTypeColorType颜色类型的枚举。
ContentAlignmentContentAlignment用于指定内容对齐方式的值枚举。
DashStyleDashStyle枚举 Line 可以采用的不同短划线样式。
FillTypeFillType填充类型的枚举。
LineCategoryLineCategoryLine 的类别的枚举。
LineFillTypeLineFillTypeLineFill 类型的枚举。
LineTypeLineTypeLine 类型的枚举。
LinkTypeLinkType对链接类型的枚举。
ListPresetListPreset枚举列表预设类型。
PageBackgroundTypePageBackgroundType枚举各种页面背景类型。
PageElementTypePageElementType枚举各种页面元素。
PageTypePageType对页面类型的枚举。
ParagraphAlignmentParagraphAlignment枚举各种段落对齐方式。
PlaceholderTypePlaceholderType枚举各种占位符类型。
PredefinedLayoutPredefinedLayout对预定义布局的枚举。
SelectionTypeSelectionType枚举选择类型。
ShapeTypeShapeType对形状类型的枚举。
SheetsChartEmbedTypeSheetsChartEmbedType枚举 Google 表格图表嵌入类型。
SlideLinkingModeSlideLinkingMode枚举链接幻灯片的方式。
SlidePositionSlidePosition枚举幻灯片位置类型。
SpacingModeSpacingMode枚举各种间距模式类型。
TextBaselineOffsetTextBaselineOffset枚举文本基线偏移量的类型。
TextDirectionTextDirection文本路线类型的枚举。
ThemeColorTypeThemeColorType主题颜色枚举。
VideoSourceTypeVideoSourceType一个枚举,表示视频来源的类型。

方法

方法返回类型简介
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

参数

名称类型说明
nameString要为已创建的演示文稿指定的名称。

弃踢回攻

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();
如果演示文稿已打开,则返回相同的演示文稿实例。

弃踢回攻

Presentation

授权

使用此方法的脚本需要获得以下一个或多个范围的授权:

  • 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();
}

弃踢回攻

Ui


newAffineTransformBuilder()

返回新的 AffineTransformBuilder 以构建 AffineTransform。该构建器预设了身份仿射转换。

弃踢回攻

AffineTransformBuilder


openById(id)

打开具有指定 ID 的 Presentation

// Open a presentation by ID.
var presentation = SlidesApp.openById('docId');
如果演示文稿已打开,则返回相同的演示文稿实例。

参数

名称类型说明
idString

弃踢回攻

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');
如果演示文稿已打开,则返回相同的演示文稿实例。

参数

名称类型说明
urlString

弃踢回攻

Presentation - 具有指定网址的演示文稿

授权

使用此方法的脚本需要获得以下一个或多个范围的授权:

  • https://www.googleapis.com/auth/presentations