超文字連結。
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
getLinkType() | LinkType | 傳回 LinkType 。 |
getLinkedSlide() | Slide | 針對非網址連結類型傳回已連結的 Slide (如果有的話)。 |
getSlideId() | String | 如果 LinkType 不是 LinkType.SLIDE_ID ,則傳回連結的 Slide 或 null 。 |
getSlideIndex() | Integer | 如果 LinkType 不是 LinkType.SLIDE_INDEX ,會傳回已連結 Slide 或 null 的索引 (從零開始)。 |
getSlidePosition() | SlidePosition | 如果 LinkType 並非 LinkType.SLIDE_POSITION ,會傳回已連結 Slide 的 SlidePosition ,或傳回 null 。 |
getUrl() | String | 傳回外部網頁的網址;如果 LinkType 不是 LinkType.URL ,則傳回 null 。 |
內容詳盡的說明文件
getLinkType()
getLinkedSlide()
針對非網址連結類型傳回已連結的 Slide
(如果有的話)。如果簡報中沒有該投影片,或 LinkType
為 LinkType.URL
,則傳回 null
。
var 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
getSlideId()
如果 LinkType
不是 LinkType.SLIDE_ID
,則傳回連結的 Slide
或 null
。
請注意,具有傳回的 ID 的投影片可能不存在。
var 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
getSlideIndex()
如果 LinkType
不是 LinkType.SLIDE_INDEX
,會傳回已連結 Slide
或 null
的索引 (從零開始)。
請注意,傳回索引的投影片可能不存在。
var 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
getSlidePosition()
如果 LinkType
並非 LinkType.SLIDE_POSITION
,會傳回已連結 Slide
的 SlidePosition
,或傳回 null
。
請注意,含有傳回相對位置的投影片可能不存在。
var 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
getUrl()
傳回外部網頁的網址;如果 LinkType
不是 LinkType.URL
,則傳回 null
。
var 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