PageElement
,表示演讲者特写。
const speakerSpotlight = slide.getPageElements()[0]; console.log(`Page element is of type: ${speakerSpotlight.getPageElementType().toString()}`);
方法
详细文档
alignOnPage(alignmentPosition)
将元素与页面上的指定对齐位置对齐。
参数
名称 | 类型 | 说明 |
---|---|---|
alignmentPosition | AlignmentPosition | 此页面元素在网页上的对齐位置。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
bringForward()
将网页上的页面元素前移一个元素。
页面元素不得位于组中。
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
bringToFront()
将页面元素置于页面开头。
页面元素不得位于组中。
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
duplicate()
复制页面元素。
重复的网页元素会与原始网页元素置于同一位置。
弃踢回攻
PageElement
- 此页面元素的新副本。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getBorder()
返回演讲者特写的 Border
。
// 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
getConnectionSites()
返回页面元素上的 ConnectionSite
列表;如果页面元素没有任何连接站点,则返回空列表。
弃踢回攻
ConnectionSite[]
- 连接站点列表,如果此元素没有连接站点,则可能为空。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getDescription()
返回页面元素的替代文本说明。系统会将说明与标题结合起来显示和读出替代文本。
弃踢回攻
String
- 页面元素的替代文本说明。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getHeight()
getInherentHeight()
返回元素的固有高度(以点为单位)。
页面元素的转换是相对于其固有大小而言的。结合使用固有尺寸和元素的转换,确定元素的最终视觉外观。
弃踢回攻
Number
- 页面元素的固有高度(以点为单位),如果页面元素没有高度,则为 null
。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getInherentWidth()
返回元素的固有宽度(以点为单位)。
页面元素的转换是相对于其固有大小而言的。结合使用固有尺寸和元素的转换,确定元素的最终视觉外观。
弃踢回攻
Number
- 页面元素的固有宽度(以点为单位),如果页面元素没有宽度,则为 null
。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getLeft()
返回元素的水平位置(以点为单位),当元素未旋转时,从页面左上角开始测量。
弃踢回攻
Number
- 此元素的水平位置,以点为单位,从页面左上角开始。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getMaskShapeType()
返回应用于演讲者特写的遮罩的 ShapeType
,如果没有遮罩,则返回 null
。
// 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();
弃踢回攻
ShapeType
- 演讲者特写遮罩的形状类型。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getObjectId()
返回此对象的唯一 ID。页面和页面元素使用的对象 ID 共用同一个命名空间。
弃踢回攻
String
- 此对象的唯一 ID。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPageElementType()
返回页面元素的类型,以 PageElementType
枚举表示。
弃踢回攻
PageElementType
- 页面元素的类型。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getParentGroup()
getParentPage()
getRotation()
返回元素围绕其中心的顺时针旋转角度(以度为单位),零度表示不旋转。
弃踢回攻
Number
- 介于 0(含)和 360(不含)之间的旋转角度(以度为单位)。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getTitle()
返回页面元素的替代文本标题。标题会与说明结合,以显示和读出替代文本。
弃踢回攻
String
- 页面元素的替代文本标题。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getTop()
获取元素的垂直位置(以点为单位),当元素未旋转时,从页面左上角开始测量。
弃踢回攻
Number
- 此元素的垂直位置,以点为单位,从页面左上角开始。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getTransform()
返回页面元素的转换。
页面元素的视觉外观由其绝对转换决定。要计算绝对转换,请将页面元素的转换与其所有父组的转换预串联起来。如果页面元素不在组中,则其绝对转换与此字段中的值相同。
弃踢回攻
AffineTransform
- 页面元素的转换。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getWidth()
preconcatenateTransform(transform)
将提供的转换与页面元素的现有转换进行预串联。
newTransform = argument * existingTransform
例如,要将页面元素向左移动 36 点:
element.preconcatenateTransform(SlidesApp.newAffineTransformBuilder() .setTranslateX(-36.0) .build());
您还可以将页面元素的转换替换为 setTransform(transform)
。
参数
名称 | 类型 | 说明 |
---|---|---|
transform | AffineTransform | 要预串到此页面元素的转换上的转换。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
remove()
移除页面元素。
如果在执行移除操作后,Group
仅包含一个页面元素或不包含任何页面元素,该组本身也会被移除。
如果从母版或布局中移除占位符 PageElement
,则所有继承的空占位符也会一并移除。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
scaleHeight(ratio)
按指定的比例缩放元素的高度。元素的高度是元素没有旋转时其边界框的高度。
此方法并非与所有页面元素都兼容。如需了解哪些页面元素与此方法不兼容,请参阅 大小和位置限制。
参数
名称 | 类型 | 说明 |
---|---|---|
ratio | Number | 此页面元素的高度所依据的比率。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
scaleWidth(ratio)
按指定的比例缩放元素的宽度。元素的宽度是指元素未旋转时边框的宽度。
此方法并非与所有页面元素都兼容。如需了解哪些页面元素与此方法不兼容,请参阅 大小和位置限制。
参数
名称 | 类型 | 说明 |
---|---|---|
ratio | Number | 此页面元素的宽度比率。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
select()
仅选择当前演示文稿中的 PageElement
,并移除之前的所有选择。这与使用 true
调用 select(replace)
的效果相同。
脚本只能访问运行脚本的用户的选择,并且该脚本必须绑定到演示文稿。
这会将 PageElement
的父级 Page
设置为 current page selection
。
var slide = SlidesApp.getActivePresentation().getSlides()[0]; var 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)
选择当前演示文稿中的 PageElement
。
脚本只能访问运行脚本的用户的选择,并且该脚本必须绑定到演示文稿。
将 true
传递给此方法,仅选择 PageElement
并移除之前的所有选择。这还会将 PageElement
的父级 Page
设置为 current page selection
。
传递 false
以选择多个 PageElement
对象。PageElement
对象必须位于同一 Page
中。
使用 false
参数选择页面元素时,必须满足以下条件:
PageElement
对象的父级Page
必须是current page selection
。- 不应选择多个
Page
对象。
为确保这种情况,首选方法是先使用 Page.selectAsCurrentPage()
选择父级 Page
,然后选择该页面中的页面元素。
var 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. var pageElements = slide.getPageElements(); for (var 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
sendBackward()
将页面元素向后发送一个元素。
页面元素不得位于组中。
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
sendToBack()
将页面元素发送到页面后端。
页面元素不得位于组中。
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setDescription(description)
设置页面元素的替代文本说明。
Group
元素不支持此方法。
// Set the first page element's alt text description to "new alt text description". var pageElement = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0]; pageElement.setDescription('new alt text description'); Logger.log(pageElement.getDescription());
参数
名称 | 类型 | 说明 |
---|---|---|
description | String | 要为替代文本说明设置的字符串。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setHeight(height)
设置元素的高度(以点为单位),即元素没有旋转时,其边界框的高度。
此方法并非与所有页面元素都兼容。如需了解哪些页面元素与此方法不兼容,请参阅 大小和位置限制。
参数
名称 | 类型 | 说明 |
---|---|---|
height | Number | 要设置的页面元素的新高度(以点为单位)。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setLeft(left)
设置元素的水平位置(以点为单位),当元素未旋转时,从页面左上角开始测量。
参数
名称 | 类型 | 说明 |
---|---|---|
left | Number | 要设置的新水平位置(以点为单位)。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setRotation(angle)
设置元素围绕其中心顺时针旋转的角度(以度为单位)。
此方法并非与所有页面元素都兼容。如需了解哪些页面元素与此方法不兼容,请参阅 大小和位置限制。
参数
名称 | 类型 | 说明 |
---|---|---|
angle | Number | 要设置的新顺时针旋转角度(以度为单位)。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setTitle(title)
设置页面元素的替代文本标题。
Group
元素不支持此方法。
// Set the first page element's alt text title to "new alt text title". var pageElement = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0]; pageElement.setTitle('new alt text title'); Logger.log(pageElement.getTitle());
参数
名称 | 类型 | 说明 |
---|---|---|
title | String | 要为替代文本标题设置的字符串。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setTop(top)
设置元素的垂直位置(以点为单位),当元素没有旋转时,从页面左上角开始测量。
参数
名称 | 类型 | 说明 |
---|---|---|
top | Number | 要设置的新垂直位置(以点为单位)。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setTransform(transform)
使用提供的转换设置页面元素的转换。
更新某个组的转换会更改该组中页面元素的绝对转换,这可能会改变它们的视觉外观。
更新组中某个页面元素的转换只会更改该页面元素的转换,而不会影响该组或该组中其他页面元素的转换。
如需详细了解转换如何影响页面元素的视觉外观,请参阅 getTransform()
。
参数
名称 | 类型 | 说明 |
---|---|---|
transform | AffineTransform | 为此页面元素设置的转换。 |
弃踢回攻
SpeakerSpotlight
- 此元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setWidth(width)
设置元素的宽度(以点为单位),即元素没有旋转时,其边界框的宽度。
此方法并非与所有页面元素都兼容。如需了解哪些页面元素与此方法不兼容,请参阅 大小和位置限制。
参数
名称 | 类型 | 说明 |
---|---|---|
width | Number | 要设置的页面元素的新宽度(以点为单位)。 |
弃踢回攻
SpeakerSpotlight
- 此页面元素,用于链接。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations