超文字連結。
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
get | Link | 傳回 Link。 |
get | Slide|null | 如果存在非網址連結類型,則傳回連結的 Slide。 |
get | String|null | 如果 Link 不是 Link,則傳回連結的 Slide 或 null 的 ID。 |
get | Integer|null | 如果 Link 不是 Link,則傳回連結 Slide 或 null 的索引 (從零開始計算)。 |
get | Slide | 如果 Link 不是 Link,則傳回連結的 Slide 或 null 的 Slide。 |
get | String|null | 如果 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()}`); }
回攻員
Slide|null
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Slide Id()
如果 Link 不是 Link,則傳回連結的 Slide 或 null 的 ID。
請注意,傳回的 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|null
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Slide Index()
如果 Link 不是 Link,則傳回連結 Slide 或 null 的索引 (從零開始計算)。
請注意,傳回索引的投影片可能不存在。
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|null
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
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()}`, ); }
回攻員
Slide
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Url()
傳回外部網頁的網址,或 null (如果 Link 不是 Link)。
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|null
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations