اختيار المستخدم في العرض التقديمي النشط
const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage(); const selectionType = selection.getSelectionType();
الطُرق
| الطريقة | نوع القيمة التي يتم عرضها | وصف قصير |
|---|---|---|
get | Page | تعرِض هذه السمة القيمة Page أو null النشطة حاليًا إذا لم تكن هناك صفحة نشطة. |
get | Page | عرض مجموعة Page من مثيلات Page التي تم
اختيارها أو null إذا لم يتم اختيار أي مثيلات Page |
get | Page | تعرِض Page مجموعة من عناصر Page في شريط الفيلم التي تم
اختيارها أو null إذا لم يكن الاختيار من النوع Selection. |
get | Selection | عرض Selection |
get | Table | عرض مجموعة Table من مثيلات Table التي تم اختيارها
أو null إذا لم يتم اختيار أي مثيلات Table |
get | Text | تعرِض هذه الدالة العنصر Text المحدَّد أو null إذا لم يكن الاختيار من النوع
Selection. |
مستندات تفصيلية
get Current Page()
تعرِض هذه السمة القيمة Page أو null النشطة حاليًا إذا لم تكن هناك صفحة نشطة.
const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage(); if (currentPage != null) { Logger.log(`Selected current active page ID: ${currentPage.getObjectId()}`); }
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Element Range()
عرض مجموعة Page من مثيلات Page التي تم
اختيارها أو null إذا لم يتم اختيار أي مثيلات Page
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}`); }
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Range()
تعرِض Page مجموعة من عناصر Page في شريط الفيلم التي تم
اختيارها أو null إذا لم يكن الاختيار من النوع Selection.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.PAGE) { const pageRange = selection.getPageRange(); Logger.log( `Number of pages in the flimstrip selected: ${ pageRange.getPages().length}`, ); }
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Selection Type()
عرض Selection
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()}`); }
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Table Cell Range()
عرض مجموعة Table من مثيلات Table التي تم اختيارها
أو null إذا لم يتم اختيار أي مثيلات Table
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}`); }
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Text Range()
تعرِض هذه الدالة العنصر Text المحدَّد أو null إذا لم يكن الاختيار من النوع
Selection.
يمثّل الرمز Text سيناريوهَين:
1. نطاق النص المحدّد على سبيل المثال، إذا كان الشكل يحتوي على النص "مرحبًا"، وتم اختيار "هو"،
يكون النطاق المعروض هو Text = 0 وText =
2.
2. موضع المؤشر على سبيل المثال، إذا كان الشكل يحتوي على النص "مرحبًا"، وكان المؤشر بعد "ح"،
("ح|مرحبًا")، يكون للنطاق المعروض القيمة Text = 1 وText = 1.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.TEXT) { const currentPage = selection.getCurrentPage(); const pageElement = selection.getPageElementRange().getPageElements()[0]; const textRange = selection.getTextRange(); Logger.log(`Text selected: ${textRange.asString()}`); }
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations