Stay organized with collections Save and categorize content based on your preferences.
Detailed documentationgetLinkType()
Returns the LinkType
.
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()}`); }Return
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/presentations.currentonly
https://www.googleapis.com/auth/presentations
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
.
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()}`); }Return Authorization
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/presentations.currentonly
https://www.googleapis.com/auth/presentations
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.
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()}`); }Return
String
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/presentations.currentonly
https://www.googleapis.com/auth/presentations
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.
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()}`); }Return
Integer
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/presentations.currentonly
https://www.googleapis.com/auth/presentations
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.
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()}`, ); }Return Authorization
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/presentations.currentonly
https://www.googleapis.com/auth/presentations
getUrl()
Returns the URL to the external web page or null
if the LinkType
is not LinkType.URL
.
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()}`); }Return
String
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/presentations.currentonly
https://www.googleapis.com/auth/presentations
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["A `Link` object represents a hypertext link associated with a shape in Google Slides."],["It provides methods to determine the link type, retrieve linked slide information (if applicable), and access the URL for external web page links."],["The `getLinkType()` method identifies the type of link, such as URL, slide ID, or slide index."],["Methods like `getLinkedSlide()`, `getSlideId()`, `getSlideIndex()`, and `getSlidePosition()` retrieve information about linked slides based on the link type."],["The `getUrl()` method returns the URL if the link type is `URL`, otherwise, it returns `null`."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4