表示演讲者特写的 Page。
const slide = SlidesApp.getActivePresentation().getSlides()[0]; const speakerSpotlight = slide.getPageElements()[0]; console.log( `Page element is of type: ${ speakerSpotlight.getPageElementType().toString()}`, );
方法
详细文档
align On Page(alignmentPosition)
将元素与页面上的指定对齐位置对齐。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
alignment | Alignment | 相应页面元素在页面上的对齐位置。 |
返回
Speaker - 此页面元素,用于链式调用。
bring Forward()
将页面元素在页面上向前移动一个元素。
页面元素不得位于群组中。
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
bring To Front()
将页面元素置于页面最前面。
页面元素不得位于群组中。
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
duplicate()
复制页面元素。
复制的页面元素放置在与原始元素相同的页面和位置。
返回
Page -相应页面元素的新副本。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Border()
返回发言人聚光灯的 Border。
const slide = SlidesApp.getActivePresentation().getSlides()[0]; // Gets the first element on the page, which in // this example is of type speaker spotlight. const speakerSpotlight = slide.getPageElements()[0]; // Gets the border of the speaker spotlight. const border = speakerSpotlight.getBorder();
返回
Border - 演讲者聚焦的边框。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Connection Sites()
返回页面元素上的 Connection 列表;如果页面元素没有任何连接点,则返回空列表。
返回
Connection - 连接网站列表,如果此元素没有连接网站,则可能为空。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Description()
返回网页元素的替代文本说明。说明与标题结合使用,以显示和朗读替代文本。
返回
String - 网页元素的替代文本说明。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Height()
get Inherent Height()
返回元素的固有高度(以点为单位)。
网页元素的转换是相对于其固有大小而言的。结合使用固有大小和元素的转换来确定元素的最终视觉外观。
返回
Number|null - 页面元素的固有高度(以点为单位),如果页面元素没有高度,则为 null。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Inherent Width()
返回元素的固有宽度(以点为单位)。
网页元素的转换是相对于其固有大小而言的。结合使用固有大小和元素的转换来确定元素的最终视觉外观。
返回
Number|null - 页面元素的固有宽度(以点为单位),如果页面元素没有宽度,则为 null。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Left()
返回元素在页面中的水平位置(以点为单位),当元素未旋转时,该位置从页面的左上角开始测量。
返回
Number - 相应元素在页面上的水平位置(以点为单位),从页面左上角开始计算。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Mask Shape Type()
返回应用于演讲者聚焦画面的遮盖的 Shape,如果没有遮盖,则返回 null。
const slide = SlidesApp.getActivePresentation().getSlides()[0]; // Gets the first element on the page, which in // this example is of type speaker spotlight. const speakerSpotlight = slide.getPageElements()[0]; // Gets the shape type of the mask on the speaker spotlight. const maskShapeType = speakerSpotlight.getMaskShapeType();
返回
Shape - 演讲者特写蒙版的形状类型。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Object Id()
返回相应对象的唯一 ID。网页和网页元素使用的对象 ID 共享同一命名空间。
返回
String - 相应对象的唯一 ID。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Element Type()
返回网页元素的类型,以 Page 枚举表示。
返回
Page - 页面元素的类型。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Parent Group()
get Parent Page()
get Rotation()
返回元素围绕其中心顺时针旋转的角度(以度为单位),其中零度表示不旋转。
返回
Number - 旋转角度,以度为单位,介于 0(含)和 360(不含)之间。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Title()
返回网页元素的替代文本标题。系统会将标题与说明结合起来,以显示和朗读替代文本。
返回
String - 网页元素的替代文本标题。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Top()
获取元素在页面中的垂直位置(以点为单位),该位置是从元素的左上角测量的(当元素未旋转时)。
返回
Number - 相应元素在页面上的垂直位置(以点为单位),从页面左上角开始计算。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Transform()
返回页面元素的转换。
网页元素的视觉外观由其绝对转换决定。若要计算绝对转换,请将页面元素的转换与所有父组的转换预先串联起来。如果页面元素不在群组中,则其绝对转换与此字段中的值相同。
返回
Affine - 网页元素的转换。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Width()
preconcatenate Transform(transform)
将提供的转换预串联到网页元素的现有转换。
newTransform = argument * existingTransform;
例如,如需将页面元素向左移动 36 点,请执行以下操作:
const element = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0]; element.preconcatenateTransform( SlidesApp.newAffineTransformBuilder().setTranslateX(-36.0).build(), );
您还可以将网页元素的转换替换为 set。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
transform | Affine | 要预先串联到此页面元素的转换的转换。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
remove()
移除网页元素。
如果移除操作后,Group 仅包含一个或不包含任何页面元素,则该组本身也会被移除。
如果主布局或布局中移除了占位符 Page,则所有继承的空占位符也会一并移除。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
scale Height(ratio)
按指定比例缩放元素的高度。当元素未旋转时,元素的高度是其边界框的高度。
此方法不适用于所有网页元素。如需了解哪些页面元素与此方法不兼容,请参阅 大小调整和定位限制。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
ratio | Number | 用于缩放相应网页元素高度的比率。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
scale Width(ratio)
按指定比例缩放元素的宽度。元素的宽度是指元素未旋转时其边界框的宽度。
此方法不适用于所有网页元素。如需了解哪些页面元素与此方法不兼容,请参阅 大小调整和定位限制。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
ratio | Number | 用于缩放相应网页元素宽度的比率。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
select()
仅选择有效演示中的 Page,并移除任何之前的选择。这与使用 true 调用 select(replace) 相同。
脚本只能访问运行该脚本的用户的选择内容,并且只有当脚本绑定到演示文稿时才能访问。
这会将 Page 的父 Page 设置为 current page selection。
const slide = SlidesApp.getActivePresentation().getSlides()[0]; const pageElement = slide.getPageElements()[0]; // Only select this page element and replace any previous selection. pageElement.select();
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
select(replace)
选择当前演示中的 Page。
脚本只能访问运行该脚本的用户的选择内容,并且只有当脚本绑定到演示文稿时才能访问。
将 true 传递给此方法,以仅选择 Page 并移除任何之前的选择。这还会将 Page 的父 Page 设置为 current page selection。
传递 false 以选择多个 Page 对象。Page 对象必须位于同一 Page 中。
使用 false 参数选择网页元素时,必须满足以下条件:
Page对象的父级Element Page必须是current page selection。- 不应选择多个
Page对象。
为确保这种情况,首选方法是先使用 Page.selectAsCurrentPage() 选择父级 Page,然后选择该页面中的网页元素。
const slide = SlidesApp.getActivePresentation().getSlides()[0]; // First select the slide page, as the current page selection. slide.selectAsCurrentPage(); // Then select all the page elements in the selected slide page. const pageElements = slide.getPageElements(); for (let i = 0; i < pageElements.length; i++) { pageElements[i].select(false); }
参数
| 名称 | 类型 | 说明 |
|---|---|---|
replace | Boolean | 如果值为 true,则所选内容会替换任何先前所选内容;否则,所选内容会添加到任何先前所选内容中。 |
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
send Backward()
将页面元素在页面上向后移动一个元素。
页面元素不得位于群组中。
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
send To Back()
将页面元素发送到页面后方。
页面元素不得位于群组中。
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Description(description)
设置网页元素的替代文本说明。
该方法不支持 Group 元素。
// Set the first page element's alt text description to "new alt text // description". const pageElement = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0]; pageElement.setDescription('new alt text description'); Logger.log(pageElement.getDescription());
参数
| 名称 | 类型 | 说明 |
|---|---|---|
description | String | 用于设置替代文本说明的字符串。 |
返回
Speaker - 此页面元素。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Height(height)
以磅为单位设置元素的高度,即元素在未旋转时其边界框的高度。
此方法不适用于所有网页元素。如需了解哪些页面元素与此方法不兼容,请参阅 大小调整和定位限制。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
height | Number | 要设置的相应页面元素的新高度(以点为单位)。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Left(left)
设置元素在页面中的水平位置(以点为单位),该位置从元素的左上角开始测量(当元素未旋转时)。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
left | Number | 要设置的新水平位置(以点为单位)。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Rotation(angle)
设置元素围绕其中心顺时针旋转的角度(以度为单位)。
此方法不适用于所有网页元素。如需了解哪些页面元素与此方法不兼容,请参阅 大小调整和定位限制。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
angle | Number | 要设置的新顺时针旋转角度(以度为单位)。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Title(title)
设置网页元素的替代文本标题。
该方法不支持 Group 元素。
// Set the first page element's alt text title to "new alt text title". const pageElement = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0]; pageElement.setTitle('new alt text title'); Logger.log(pageElement.getTitle());
参数
| 名称 | 类型 | 说明 |
|---|---|---|
title | String | 要将替代文本标题设置为的字符串。 |
返回
Speaker - 此页面元素。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Top(top)
设置元素的垂直位置(以点为单位),当元素未旋转时,该位置从页面的左上角开始测量。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
top | Number | 要设置的新垂直位置(以点为单位)。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Transform(transform)
使用提供的转换设置页面元素的转换。
更新组的转换会更改该组中页面元素的绝对转换,从而改变其视觉外观。
更新组中某个页面元素的转换只会更改该页面元素的转换,而不会影响组或组中其他页面元素的转换。
如需详细了解转换如何影响网页元素的视觉外观,请参阅 get。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
transform | Affine | 为相应网页元素设置的转换。 |
返回
Speaker - 此元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Width(width)
以磅为单位设置元素的宽度,即元素在未旋转时其边界框的宽度。
此方法不适用于所有网页元素。如需了解哪些页面元素与此方法不兼容,请参阅 大小调整和定位限制。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
width | Number | 要设置的相应页面元素的新宽度(以磅为单位)。 |
返回
Speaker - 此页面元素,用于链式调用。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations