超文本链接。
方法
| 方法 | 返回类型 | 简介 |
|---|---|---|
get | Link | 返回 Link。 |
get | Slide | 返回非网址链接类型的关联 Slide(如果有)。 |
get | String | 返回关联的 Slide 的 ID,如果 Link 不是 Link,则返回 null。 |
get | Integer | 如果 Link 不是 Link,则返回关联的 Slide 或 null 的从零开始的索引。 |
get | Slide | 如果 Link 不是 Link,则返回关联的 Slide 或 null 的 Slide。 |
get | String | 返回外部网页的网址,如果 Link 不是 Link,则返回 null。 |
详细文档
get Link Type()
返回 Link。
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null) { Logger.log(`Shape has a link of type: ${link.getLinkType()}`); }
返回
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Linked Slide()
返回非网址链接类型的关联 Slide(如果有)。如果幻灯片不存在于演示文稿中,或者 Link 为 Link,则返回 null。
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() !== SlidesApp.LinkType.URL) { Logger.log(`Shape has link to slide: ${link.getLinkedSlide()}`); }
返回
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Slide Id()
返回关联的 Slide 的 ID;如果 Link 不是 Link,则返回 null。
请注意,返回的 ID 对应的幻灯片可能不存在。
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_ID) { Logger.log(`Shape has link to slide with ID: ${link.getSlideId()}`); }
返回
String
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Slide Index()
返回关联的 Slide 或 null(如果 Link 不是 Link)的从零开始的索引。
请注意,返回的索引对应的幻灯片可能不存在。
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_INDEX) { Logger.log(`Shape has link to slide with index: ${link.getSlideIndex()}`); }
返回
Integer
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Slide Position()
如果 Link 不是 Link,则返回关联的 Slide 或 null 的 Slide。
请注意,返回的相对位置对应的幻灯片可能不存在。
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_POSITION) { Logger.log( `Shape has link to slide with relative position: ${ link.getSlidePosition()}`, ); }
返回
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Url()
返回外部网页的网址,如果 Link 不是 Link,则返回 null。
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.URL) { Logger.log(`Shape has link to URL: ${link.getUrl()}`); }
返回
String
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations