Class Link

Link

A hypertext link.

Methods

MethodReturn typeBrief description
getLinkType()LinkTypeReturns the LinkType.
getLinkedSlide()SlideReturns the linked Slide for non-URL links types, if it exists.
getSlideId()StringReturns the ID of the linked Slide or null if the LinkType is not LinkType.SLIDE_ID.
getSlideIndex()IntegerReturns the zero-based index of the linked Slide or null if the LinkType is not LinkType.SLIDE_INDEX.
getSlidePosition()SlidePositionReturns the SlidePosition of the linked Slide or null if the LinkType is not LinkType.SLIDE_POSITION.
getUrl()StringReturns the URL to the external web page or null if the LinkType is not LinkType.URL.

Detailed documentation

getLinkType()

Returns the LinkType.

 var link = shape.getLink();
 if (link != null) {
   Logger.log('Shape has a link of type: ' + link.getLinkType());
 }
 

Return

LinkType


getLinkedSlide()

Returns the linked Slide for non-URL links types, if it exists. Returns null if the slide doesn't exist in the presentation, or if the LinkType is LinkType.URL.

 var link = shape.getLink();
 if (link != null && link.getLinkType() != SlidesApp.LinkType.URL) {
   Logger.log('Shape has link to slide: ' + link.getLinkedSlide());
 }
 

Return

Slide


getSlideId()

Returns the ID of the linked Slide or null if the LinkType is not LinkType.SLIDE_ID.

Note that the slide with the returned ID might not exist.

 var link = shape.getLink();
 if (link != null && link.getLinkType() == SlidesApp.LinkType.SLIDE_ID) {
   Logger.log('Shape has link to slide with ID: ' + link.getSlideId());
 }
 

Return

String


getSlideIndex()

Returns the zero-based index of the linked Slide or null if the LinkType is not LinkType.SLIDE_INDEX.

Note that the slide at the returned index might not exist.

 var link = shape.getLink();
 if (link != null && link.getLinkType() == SlidesApp.LinkType.SLIDE_INDEX) {
   Logger.log('Shape has link to slide with index: ' + link.getSlideIndex());
 }
 

Return

Integer


getSlidePosition()

Returns the SlidePosition of the linked Slide or null if the LinkType is not LinkType.SLIDE_POSITION.

Note that the slide with the returned relative position might not exist.

 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());
 }
 

Return

SlidePosition


getUrl()

Returns the URL to the external web page or null if the LinkType is not LinkType.URL.

 var link = shape.getLink();
 if (link != null && link.getLinkType() == SlidesApp.LinkType.URL) {
   Logger.log('Shape has link to URL: ' + link.getUrl());
 }
 

Return

String

Send feedback about...

Apps Script
Apps Script