A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/reference/slides/selection below:

Class Selection | Apps Script

Class Selection

Stay organized with collections Save and categorize content based on your preferences.

Selection

The user's selection in the active presentation.

const selection = SlidesApp.getActivePresentation().getSelection();
const currentPage = selection.getCurrentPage();
const selectionType = selection.getSelectionType();
Detailed documentation getCurrentPage()

Returns the currently active Page or null if there is no active page.

const selection = SlidesApp.getActivePresentation().getSelection();
const currentPage = selection.getCurrentPage();
if (currentPage != null) {
  Logger.log(`Selected current active page ID: ${currentPage.getObjectId()}`);
}
Return

Page

Scripts that use this method require authorization with one or more of the following scopes:

getPageElementRange()

Returns the PageElementRange collection of PageElement instances that are selected or null if there are no PageElement instances selected.

const selection = SlidesApp.getActivePresentation().getSelection();
const selectionType = selection.getSelectionType();
if (selectionType === SlidesApp.SelectionType.PAGE_ELEMENT) {
  const currentPage = selection.getCurrentPage();
  const pageElements = selection.getPageElementRange().getPageElements();
  Logger.log(`Number of page elements selected: ${pageElements.length}`);
}
Return

PageElementRange

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

getSelectionType()

Returns the SelectionType.

const selection = SlidesApp.getActivePresentation().getSelection();
const selectionType = selection.getSelectionType();
if (selectionType === SlidesApp.SelectionType.CURRENT_PAGE) {
  const currentPage = selection.getCurrentPage();
  Logger.log(`Selected current active page ID: ${currentPage.getObjectId()}`);
}
Return

SelectionType

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

getTableCellRange()

Returns the TableCellRange collection of TableCell instances that are selected or null if there are no TableCell instances selected.

const selection = SlidesApp.getActivePresentation().getSelection();
const selectionType = selection.getSelectionType();
if (selectionType === SlidesApp.SelectionType.TABLE_CELL) {
  const currentPage = selection.getCurrentPage();
  const tableCells = selection.getTableCellRange().getTableCells();
  const table = tableCells[0].getParentTable();
  Logger.log(`Number of table cells selected: ${tableCells.length}`);
}
Return

TableCellRange

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

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."],[[["The `Selection` object represents the user's current selection within a Google Slide presentation, encompassing various elements like pages, shapes, text, or table cells."],["It provides methods to identify the type of selection, retrieve the selected elements, and access their properties."],["Developers can utilize the `Selection` object to programmatically interact with and manipulate the selected content within the presentation."],["This includes retrieving the selected page, page elements, table cells, or text range, allowing for customized actions based on the user's selection."],["The `Selection` object enables automation and customization of Google Slides presentations based on user interactions and selections."]]],["The document outlines how to manage selections within Google Slides using the SlidesApp. Key actions include: retrieving the current page, determining the selection type, and accessing selected elements. Methods allow retrieving selected page elements, pages, table cells, or text ranges. Each method returns a specific object type related to the selection or `null` if no selection is made or the selection does not match the method type. Authorization for `presentations` scopes is required.\n"]]


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