簡報。
方法
內容詳盡的說明文件
addEditor(emailAddress)
將指定的使用者新增至 Presentation
的編輯者清單。如果使用者已在檢視者清單中,這個方法會在檢視者清單中推薦使用者。
參數
名稱 | 類型 | 說明 |
---|---|---|
emailAddress | String | 要新增的使用者電子郵件地址。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
addEditor(user)
將指定的使用者新增至 Presentation
的編輯者清單。如果使用者已在檢視者清單中,這個方法會在檢視者清單中推薦使用者。
參數
名稱 | 類型 | 說明 |
---|---|---|
user | User | 代表要新增的使用者。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
addEditors(emailAddresses)
將指定的使用者陣列新增至 Presentation
的編輯者清單。如有任何使用者已列在檢視者清單中,這個方法會將這些使用者從觀眾清單中移除。
參數
名稱 | 類型 | 說明 |
---|---|---|
emailAddresses | String[] | 要新增的使用者電子郵件地址陣列。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
addViewer(emailAddress)
將指定的使用者新增至 Presentation
的檢視者清單。如果使用者已列在編輯者清單中,這個方法就不會有任何作用。
參數
名稱 | 類型 | 說明 |
---|---|---|
emailAddress | String | 要新增的使用者電子郵件地址。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
addViewer(user)
將指定的使用者新增至 Presentation
的檢視者清單。如果使用者已列在編輯者清單中,這個方法就不會有任何作用。
參數
名稱 | 類型 | 說明 |
---|---|---|
user | User | 代表要新增的使用者。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
addViewers(emailAddresses)
將指定的使用者陣列新增至 Presentation
的檢視者清單。如有任何使用者已列在編輯者清單中,這個方法就不會對他們造成任何影響。
參數
名稱 | 類型 | 說明 |
---|---|---|
emailAddresses | String[] | 要新增的使用者電子郵件地址陣列。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
appendSlide()
使用 PredefinedLayout.BLANK
根據目前母帶的預先定義版面配置,將投影片附加到簡報結尾。目前的主要執行個體是下列其中一種:
- 目前上一張投影片的主投影片。
- 如果簡報中沒有投影片,則簡報的第一個主要投影片。
回攻員
Slide
— 附加的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
appendSlide(layout)
appendSlide(predefinedLayout)
使用根據目前母畫面指定的預先定義版面配置,將投影片附加至簡報結尾。目前的主要執行個體是下列其中一種:
- 目前上一張投影片的主投影片。
- 如果簡報中沒有投影片,則簡報的第一個主要投影片。
參數
名稱 | 類型 | 說明 |
---|---|---|
predefinedLayout | PredefinedLayout | 這是新投影片使用的預先定義版面配置,應出現在目前的主投影片中。 |
回攻員
Slide
— 附加的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
appendSlide(slide)
將所提供 Slide
的副本附加到簡報結尾。
如果正在複製的投影片來自其他簡報,如果這份簡報中沒有父項主頁和版面配置頁面,也會一併複製。
// Copy a slide from another presentation and appends it. var otherPresentation = SlidesApp.openById('presentationId'); var currentPresentation = SlidesApp.getActivePresentation(); var slide = otherPresentation.getSlides()[0]; currentPresentation.appendSlide(slide);
參數
名稱 | 類型 | 說明 |
---|---|---|
slide | Slide | 要複製及附加的投影片。 |
回攻員
Slide
— 附加的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
appendSlide(slide, linkingMode)
將來源簡報提供的 Slide
副本附加到目前簡報的結尾,並設定 SlideLinkingMode
指定的投影片連結。
如果正在複製的投影片來自其他簡報,當目前的簡報中沒有父項主頁和版面配置頁面時,也會一併複製。
如果連結模式為 SlideLinkingMode.LINKED
,則在呼叫 Slide.refreshSlide()
時,即可根據所提供的來源投影片更新附加的投影片。其他協作者則能看到來源投影片的連結。SlideLinkingMode.LINKED
無法與目前簡報的來源投影片搭配使用。
// Copy a slide from another presentation, then append and link it. var sourcePresentation = SlidesApp.openById('presentationId'); var currentPresentation = SlidesApp.getActivePresentation(); var slide = sourcePresentation.getSlides()[0]; var appendedSlide = currentPresentation.appendSlide(slide, SlidesApp.SlideLinkingMode.LINKED);
參數
名稱 | 類型 | 說明 |
---|---|---|
slide | Slide | 要複製、附加及連結的投影片。 |
linkingMode | SlideLinkingMode | 要使用的連結模式。 |
回攻員
Slide
:新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getEditors()
取得這個 Presentation
的編輯者清單。
回攻員
User[]
:具備編輯權限的一系列使用者。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getId()
取得簡報的專屬 ID。呈現 ID 與 SlidesApp.openById()
搭配使用,即可開啟特定的呈現例項。
回攻員
String
:這份簡報的 ID,
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getLayouts()
getMasters()
getName()
取得簡報的名稱或名稱。
回攻員
String
— 這份簡報的標題。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getNotesMaster()
取得簡報的筆記總體。
回攻員
NotesMaster
:簡報的主音,
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getNotesPageHeight()
取得簡報主投影片和附註頁面的頁面高度。它們的頁面高度都相同,
回攻員
Number
:記事頁面的高度 (以點為單位)。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getNotesPageWidth()
取得簡報中備忘稿和筆記頁面的頁面寬度。它們的頁面寬度都相同。
回攻員
Number
:記事頁面的寬度 (以點為單位)。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPageElementById(id)
傳回具有指定 ID 的 PageElement
,如果不存在,則傳回 null
。
參數
名稱 | 類型 | 說明 |
---|---|---|
id | String | 所擷取網頁元素的 ID。 |
回攻員
PageElement
:具有指定 ID 的網頁元素。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPageHeight()
取得簡報中投影片、版面配置和主投影片的頁面高度。它們的頁面高度都相同,
回攻員
Number
:以點為單位的頁面高度。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPageWidth()
取得簡報中投影片、版面配置和主投影片的頁面寬度。它們的頁面寬度都相同。
回攻員
Number
:以點為單位的頁面寬度。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getSelection()
在使用中的簡報中選取使用者。指令碼只有在指令碼繫結至簡報時,才能存取執行指令碼的使用者選取項目。
請注意,傳回的選項是目前有效的選項。當指令碼對簡報進行各種變更時,系統會轉換選取項目以將其納入考量。舉例來說,如果選取了 A 和 B 兩個形狀,然後指令碼移除形狀 B,則傳回的選取物件會以隱含方式更新,只選取 A 形狀。
// Gets the current active page that is selected in the active presentation. var selection = SlidesApp.getActivePresentation().getSelection(); var currentPage = selection.getCurrentPage();
回攻員
Selection
:表示使用者選取的內容;如果指令碼未繫結至簡報,或缺少有效的使用者選取項目,則為 null
。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getSlideById(id)
getSlides()
getUrl()
擷取網址以存取這份簡報。
var presentation = SlidesApp.getActivePresentation(); // Send out the link to open the presentation. MailApp.sendEmail("<email-address>", presentation.getName(), presentation.getUrl());
回攻員
String
:存取目前簡報的網址。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getViewers()
取得此Presentation
的檢視者和加註者清單。
回攻員
User[]
:具備檢視或註解權限的使用者陣列。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSlide(insertionIndex)
使用根據目前母帶的 PredefinedLayout.BLANK
預先定義版面配置,在簡報中的指定索引插入投影片。目前的主要執行個體是下列其中一種:
- 前一張投影片的主投影片。
- 如果插入索引為零,第一張投影片的主投影片。
- 如果簡報中沒有投影片,則簡報的第一個主要投影片。
參數
名稱 | 類型 | 說明 |
---|---|---|
insertionIndex | Integer | 從 0 開始的索引,指出投影片的插入位置。 |
回攻員
Slide
:插入的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSlide(insertionIndex, layout)
根據目前母帶的指定版面配置,在簡報中的指定索引插入投影片。目前的主要執行個體是下列其中一種:
- 前一張投影片的主投影片。
- 如果插入索引為零,第一張投影片的主投影片。
- 如果簡報中沒有投影片,則簡報的第一個主要投影片。
參數
名稱 | 類型 | 說明 |
---|---|---|
insertionIndex | Integer | 從 0 開始的索引,指出投影片的插入位置。 |
layout | Layout | 新投影片使用的版面配置;應該位於目前的主投影片中。 |
回攻員
Slide
:插入的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSlide(insertionIndex, predefinedLayout)
這個外掛程式能使用根據目前母畫面指定的預先定義版面配置,在簡報中的指定索引插入投影片。目前的主要執行個體是下列其中一種:
- 前一張投影片的主投影片。
- 如果插入索引為零,第一張投影片的主投影片。
- 如果簡報中沒有投影片,則簡報的第一個主要投影片。
參數
名稱 | 類型 | 說明 |
---|---|---|
insertionIndex | Integer | 從 0 開始的索引,指出投影片的插入位置。 |
predefinedLayout | PredefinedLayout | 這是新投影片使用的預先定義版面配置,應出現在目前的主投影片中。 |
回攻員
Slide
:插入的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSlide(insertionIndex, slide)
在簡報中的指定索引插入提供的 Slide
副本。
如果正在複製的投影片來自其他簡報,如果這份簡報中沒有父項主頁和版面配置頁面,也會一併複製。
// Copy a slide from another presentation and inserts it. var otherPresentation = SlidesApp.openById('presentationId'); var currentPresentation = SlidesApp.getActivePresentation(); var slide = otherPresentation.getSlides()[0]; var insertionIndex = 1; currentPresentation.insertSlide(insertionIndex, slide);
參數
名稱 | 類型 | 說明 |
---|---|---|
insertionIndex | Integer | 從 0 開始的索引,指出投影片的插入位置。 |
slide | Slide | 要複製及插入的投影片。 |
回攻員
Slide
:插入的新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSlide(insertionIndex, slide, linkingMode)
這個外掛程式能將來源簡報中已提供的 Slide
副本插入目前簡報中的指定索引,然後設定 SlideLinkingMode
指定的投影片連結。
如果正在複製的投影片來自其他簡報,當目前的簡報中沒有父項主頁和版面配置頁面時,也會一併複製。
如果連結模式為 SlideLinkingMode.LINKED
,則在呼叫 Slide.refreshSlide()
時,即可根據所提供的來源投影片更新插入的投影片。其他協作者則能看到來源投影片的連結。SlideLinkingMode.LINKED
無法與目前簡報的來源投影片搭配使用。
// Copy a slide from another presentation, then insert and link it. var sourcePresentation = SlidesApp.openById('presentationId'); var currentPresentation = SlidesApp.getActivePresentation(); var slide = sourcePresentation.getSlides()[0]; var insertionIndex = 1; var insertedSlide = currentPresentation.insertSlide( insertionIndex, slide, SlidesApp.SlideLinkingMode.LINKED);
參數
名稱 | 類型 | 說明 |
---|---|---|
insertionIndex | Integer | 從 0 開始的索引,指出投影片的插入位置。 |
slide | Slide | 要複製及插入的投影片。 |
linkingMode | SlideLinkingMode | 要使用的連結模式。 |
回攻員
Slide
:新投影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
removeEditor(emailAddress)
將指定使用者從 Presentation
的編輯者清單中移除。如果使用者屬於具備一般存取權的使用者類別,此方法不會禁止使用者存取 Presentation
。舉例來說,如果 Presentation
是與使用者整個網域共用,或是 Presentation
位於該使用者可存取的共用雲端硬碟中,則他們無法這麼做。
若是雲端硬碟檔案,則也會將使用者從檢視者清單中移除。
參數
名稱 | 類型 | 說明 |
---|---|---|
emailAddress | String | 要移除的使用者電子郵件地址。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
removeEditor(user)
將指定使用者從 Presentation
的編輯者清單中移除。如果使用者屬於具備一般存取權的使用者類別,此方法不會禁止使用者存取 Presentation
。舉例來說,如果 Presentation
是與使用者整個網域共用,或是 Presentation
位於該使用者可存取的共用雲端硬碟中,則他們無法這麼做。
若是雲端硬碟檔案,則也會將使用者從檢視者清單中移除。
參數
名稱 | 類型 | 說明 |
---|---|---|
user | User | 代表要移除的使用者。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
removeViewer(emailAddress)
將特定使用者從「Presentation
」的檢視者和加註者清單中移除。如果使用者是編輯者,而非檢視者或加註者,這個方法就不會生效。此外,假如使用者屬於具有一般存取權的使用者類別,例如 Presentation
已與使用者的整個網域共用,或 Presentation
位於該使用者可存取的共用雲端硬碟中,此方法也不會阻止使用者存取 Presentation
。
針對雲端硬碟檔案,這麼做也會將使用者從編輯者清單中移除。
參數
名稱 | 類型 | 說明 |
---|---|---|
emailAddress | String | 要移除的使用者電子郵件地址。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
removeViewer(user)
將特定使用者從「Presentation
」的檢視者和加註者清單中移除。如果使用者是編輯者,而不是檢視者,這個方法就不會生效。如果使用者屬於具有一般存取權的使用者類別,此方法也不會禁止使用者存取 Presentation
。例如,假設 Presentation
是與使用者整個網域共用,或是 Presentation
位於該使用者可存取的共用雲端硬碟中。
針對雲端硬碟檔案,這麼做也會將使用者從編輯者清單中移除。
參數
名稱 | 類型 | 說明 |
---|---|---|
user | User | 代表要移除的使用者。 |
回攻員
Presentation
— 此 Presentation
用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
replaceAllText(findText, replaceText)
以取代文字取代所有符合搜尋文字的項目。搜尋不區分大小寫。
參數
名稱 | 類型 | 說明 |
---|---|---|
findText | String | 要尋找的文字。 |
replaceText | String | 要取代相符文字的文字。 |
回攻員
Integer
:變更的重複次數
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
replaceAllText(findText, replaceText, matchCase)
以取代文字取代所有符合搜尋文字的項目。
參數
名稱 | 類型 | 說明 |
---|---|---|
findText | String | 要尋找的文字。 |
replaceText | String | 要取代相符文字的文字。 |
matchCase | Boolean | 如果值為 true ,則搜尋會區分大小寫;如果值為 false ,則搜尋不區分大小寫。 |
回攻員
Integer
:變更的重複次數
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
saveAndClose()
儲存目前的 Presentation
。導致系統清除並套用待處理的更新。
針對每個開啟的 Presentation
,系統會在指令碼執行結束時自動叫用 saveAndClose()
方法,即使指令碼執行作業因錯誤而終止也一樣。
無法編輯已關閉的「Presentation
」。使用 SlidesApp
中的其中一種開啟方法,重新開啟簡報來進行編輯。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
setName(name)
設定簡報的名稱或名稱。
參數
名稱 | 類型 | 說明 |
---|---|---|
name | String | 為這份簡報設定的名稱。 |
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations