Class Selection

चुनना

ऐक्टिव प्रज़ेंटेशन में उपयोगकर्ता का चुना गया विकल्प.

var selection = SlidesApp.getActivePresentation().getSelection();
var currentPage = selection.getCurrentPage();
var selectionType = selection.getSelectionType();
}

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
getCurrentPage()Pageअगर कोई पेज चालू नहीं है, तो मौजूदा चालू Page या null दिखाता है.
getPageElementRange()PageElementRangeयह फ़ंक्शन PageElement इंस्टेंस का PageElementRange कलेक्शन दिखाता है चुना गया या अगर कोई PageElement इंस्टेंस नहीं चुना गया है, तो null.
getPageRange()PageRangePageRange को फ़्लोस्ट्रिप में Page इंस्टेंस का संग्रह देता है चयनित या null, अगर चयन SelectionType.PAGE प्रकार का नहीं है.
getSelectionType()SelectionTypeयह फ़ंक्शन SelectionType को दिखाता है.
getTableCellRange()TableCellRangeचुने गए TableCell इंस्टेंस का TableCellRange कलेक्शन दिखाता है या अगर कोई TableCell इंस्टेंस नहीं चुना गया है, तो null.
getTextRange()TextRangeचुना गया TextRange दिखाता है. अगर चुना गया विकल्प किसी तरह का नहीं है, तो null दिखाता है SelectionType.TEXT.

विस्तृत दस्तावेज़

getCurrentPage()

अगर कोई पेज चालू नहीं है, तो मौजूदा चालू Page या null दिखाता है.

var selection = SlidesApp.getActivePresentation().getSelection();
var currentPage = selection.getCurrentPage();
if (currentPage != null) {
  Logger.log('Selected current active page ID: ' + currentPage.getObjectId());
}

वापसी का टिकट

Page

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, यहां दिए गए एक या एक से ज़्यादा स्कोप की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getPageElementRange()

यह फ़ंक्शन PageElement इंस्टेंस का PageElementRange कलेक्शन दिखाता है चुना गया या अगर कोई PageElement इंस्टेंस नहीं चुना गया है, तो null.

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

वापसी का टिकट

PageElementRange

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, यहां दिए गए एक या एक से ज़्यादा स्कोप की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getPageRange()

PageRange को फ़्लोस्ट्रिप में Page इंस्टेंस का संग्रह देता है चयनित या null, अगर चयन SelectionType.PAGE प्रकार का नहीं है.

var selection = SlidesApp.getActivePresentation().getSelection();
var selectionType = selection.getSelectionType();
if (selectionType == SlidesApp.SelectionType.PAGE) {
  var pageRange = selection.getPageRange();
  Logger.log('Number of pages in the flimstrip selected: ' + pageRange.getPages().length);
}
}

वापसी का टिकट

PageRange

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, यहां दिए गए एक या एक से ज़्यादा स्कोप की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getSelectionType()

यह फ़ंक्शन SelectionType को दिखाता है.

var selection = SlidesApp.getActivePresentation().getSelection();
var selectionType = selection.getSelectionType();
if (selectionType == SlidesApp.SelectionType.CURRENT_PAGE) {
  var currentPage = selection.getCurrentPage();
  Logger.log('Selected current active page ID: ' + currentPage.getObjectId());
}

वापसी का टिकट

SelectionType

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, यहां दिए गए एक या एक से ज़्यादा स्कोप की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getTableCellRange()

चुने गए TableCell इंस्टेंस का TableCellRange कलेक्शन दिखाता है या अगर कोई TableCell इंस्टेंस नहीं चुना गया है, तो null.

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

वापसी का टिकट

TableCellRange

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, यहां दिए गए एक या एक से ज़्यादा स्कोप की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getTextRange()

चुना गया TextRange दिखाता है. अगर चुना गया विकल्प किसी तरह का नहीं है, तो null दिखाता है SelectionType.TEXT.

TextRange दो स्थितियों को दिखाता है:

1. टेक्स्ट की रेंज चुनी गई. उदाहरण के लिए, अगर किसी आकार में "Hey" और "He" जैसे टेक्स्ट का इस्तेमाल किया गया है को चुना गया है, दिखाई गई रेंज में TextRange.getStartIndex() = 0 और TextRange.getEndIndex() = है 2.

2. कर्सर की पोज़िशन. उदाहरण के लिए, अगर किसी आकार में "नमस्ते" टेक्स्ट है और कर्सर "H" के बाद है, ("H|ello"), दिखाई गई रेंज में TextRange.getStartIndex() = 1 और TextRange.getEndIndex() = 1 है.

var selection = SlidesApp.getActivePresentation().getSelection();
var selectionType = selection.getSelectionType();
if (selectionType == SlidesApp.SelectionType.TEXT) {
  var currentPage = selection.getCurrentPage();
  var pageElement = selection.getPageElementRange().getPageElements()[0];
  var textRange = selection.getTextRange();
  Logger.log('Text selected: ' + textRange.asString());
}

वापसी का टिकट

TextRange

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, यहां दिए गए एक या एक से ज़्यादा स्कोप की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations