Class Selection

Seçim

Etkin sunuda kullanıcının seçimi.

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

Yöntemler

YöntemDönüş türüKısa açıklama
getCurrentPage()PageEtkin sayfa yoksa etkin olan Page veya null değerini döndürür.
getPageElementRange()PageElementRangeSeçili PageElement örneklerinden oluşan PageElementRange koleksiyonunu veya seçili PageElement örneği yoksa null değerini döndürür.
getPageRange()PageRangePageRange değerini, film şeridinde seçili olan Page örneklerinden oluşan bir koleksiyon veya seçim SelectionType.PAGE türünde değilse null döndürür.
getSelectionType()SelectionTypeSelectionType değerini döndürür.
getTableCellRange()TableCellRangeSeçili TableCell örneğinden oluşan TableCellRange koleksiyonunu veya seçili TableCell örneği yoksa null değerini döndürür.
getTextRange()TextRangeSeçilen TextRange veya seçim SelectionType.TEXT türünde değilse null döndürür.

Ayrıntılı belgeler

getCurrentPage()

Etkin sayfa yoksa etkin olan Page veya null değerini döndürür.

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

Return

Page

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamların biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getPageElementRange()

Seçili PageElement örneklerinden oluşan PageElementRange koleksiyonunu veya seçili PageElement örneği yoksa null değerini döndürür.

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

Return

PageElementRange

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamların biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getPageRange()

PageRange değerini, film şeridinde seçili olan Page örneklerinden oluşan bir koleksiyon veya seçim SelectionType.PAGE türünde değilse null döndürür.

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

Return

PageRange

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamların biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getSelectionType()

SelectionType değerini döndürür.

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

Return

SelectionType

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamların biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getTableCellRange()

Seçili TableCell örneğinden oluşan TableCellRange koleksiyonunu veya seçili TableCell örneği yoksa null değerini döndürür.

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

Return

TableCellRange

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamların biri veya daha fazlasıyla yetkilendirme gerektirir:

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

getTextRange()

Seçilen TextRange veya seçim SelectionType.TEXT türünde değilse null döndürür.

TextRange iki senaryoyu temsil eder:

1. Metin aralığı seçildi. Örneğin, bir şekilde "Merhaba" metni varsa ve "O" seçilmişse döndürülen aralık TextRange.getStartIndex() = 0 ve TextRange.getEndIndex() = 2 olur.

2. İmleç konumu. Örneğin, bir şekil "Merhaba" metni içeriyorsa ve imleç "H",("H|ello") sonrasındaysa döndürülen aralık TextRange.getStartIndex() = 1 ve TextRange.getEndIndex() = 1 olur.

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

Return

TextRange

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamların biri veya daha fazlasıyla yetkilendirme gerektirir:

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