簡報。
方法
內容詳盡的說明文件
add Editor(emailAddress)
將指定使用者新增至 Presentation 的編輯者清單。如果使用者已在觀眾名單中,這個方法會將使用者從觀眾名單中移除。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
email | String | 要新增的使用者電子郵件地址。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
add Editor(user)
將指定使用者新增至 Presentation 的編輯者清單。如果使用者已在觀眾名單中,這個方法會將使用者從觀眾名單中移除。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
user | User | 要新增的使用者代表。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
add Editors(emailAddresses)
將指定的使用者陣列新增至 Presentation 的編輯者清單。如果使用者已在觀眾名單中,這個方法會將他們從觀眾名單中移除。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
email | String[] | 要新增的使用者電子郵件地址陣列。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
add Viewer(emailAddress)
將指定使用者新增至 Presentation 的檢視者清單。如果使用者已在編輯者名單中,這個方法不會有任何作用。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
email | String | 要新增的使用者電子郵件地址。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
add Viewer(user)
將指定使用者新增至 Presentation 的檢視者清單。如果使用者已在編輯者名單中,這個方法不會有任何作用。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
user | User | 要新增的使用者代表。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
add Viewers(emailAddresses)
將指定的使用者陣列新增至 Presentation 的檢視者清單。如果使用者已在編輯者清單中,這個方法對他們不會有任何影響。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
email | String[] | 要新增的使用者電子郵件地址陣列。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
append Slide()
使用目前的母片,根據預先定義的版面配置,在簡報結尾附加投影片。Predefined目前的母項是下列其中一項:
- 目前最後一張投影片的母片。
- 簡報中的第一個母片 (如果沒有投影片)。
回攻員
Slide:附加的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
append Slide(layout)
append Slide(predefinedLayout)
根據目前的母片,使用指定的預先定義版面配置,在簡報結尾附加投影片。目前的母項是下列其中一項:
- 目前最後一張投影片的母片。
- 簡報中的第一個母片 (如果沒有投影片)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
predefined | Predefined | 新投影片要使用的預先定義版面配置,應位於目前的主版中。 |
回攻員
Slide:附加的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
append Slide(slide)
在簡報結尾附加所提供 Slide 的副本。
如果複製的投影片來自其他簡報,且該簡報中沒有上層母片和版面配置頁面,系統也會一併複製。
// Copy a slide from another presentation and appends it. const otherPresentation = SlidesApp.openById('presentationId'); const currentPresentation = SlidesApp.getActivePresentation(); const slide = otherPresentation.getSlides()[0]; currentPresentation.appendSlide(slide);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
slide | Slide | 要複製及附加的投影片。 |
回攻員
Slide:附加的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
append Slide(slide, linkingMode)
將來源簡報中提供的 Slide 副本附加到目前簡報的結尾,並根據 Slide 設定投影片連結。
如果複製的投影片來自其他簡報,且目前簡報中沒有上層母片和版面配置頁面,系統也會一併複製。
如果連結模式為 Slide,當呼叫 Slide.refreshSlide() 時,附加的投影片可以更新為與提供的來源投影片相符。其他協作者則會看到來源投影片的連結。Slide 無法與目前簡報的來源投影片搭配使用。
// Copy a slide from another presentation, then append and link it. const sourcePresentation = SlidesApp.openById('presentationId'); const currentPresentation = SlidesApp.getActivePresentation(); const slide = sourcePresentation.getSlides()[0]; const appendedSlide = currentPresentation.appendSlide( slide, SlidesApp.SlideLinkingMode.LINKED, );
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
slide | Slide | 要複製、附加及連結的投影片。 |
linking | Slide | 要使用的連結模式。 |
回攻員
Slide:新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Editors()
取得這個 Presentation 的編輯者清單。
回攻員
User[]:具有編輯權限的使用者陣列。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Id()
取得簡報的專屬 ID。簡報 ID 會與 Slides 搭配使用,開啟特定簡報例項。
回攻員
String:這份簡報的 ID。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Layouts()
get Masters()
get Name()
取得簡報的名稱或標題。
回攻員
String - 這份簡報的標題。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Notes Master()
取得簡報的備忘稿母片。
回攻員
Notes:簡報的備忘稿母片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Notes Page Height()
以點為單位,取得簡報中備忘稿母片和備忘稿頁面的高度。所有頁面的高度都相同。
回攻員
Number:附註頁面的高度 (以點為單位)。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Notes Page Width()
以點為單位,取得簡報中備忘稿母片和備忘稿頁面的頁面寬度。這些頁面的寬度都相同。
回攻員
Number:附註頁面的寬度 (以點為單位)。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Element By Id(id)
傳回具有指定 ID 的 Page,或如果不存在,則傳回 null。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
id | String | 要擷取的網頁元素 ID。 |
回攻員
Page:具有指定 ID 的頁面元素。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Height()
以點為單位,取得簡報中投影片、版面配置和母片的頁面高度。所有頁面的高度都相同。
回攻員
Number:頁面高度 (以點為單位)。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Width()
以點為單位,取得簡報中投影片、版面配置和母片的頁面寬度。這些頁面的寬度都相同。
回攻員
Number:頁面寬度 (以點為單位)。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Selection()
取得使用者的選取項目 (使用中的簡報)。指令碼只能存取執行指令碼的使用者選取的內容,且指令碼必須繫結至簡報。
請注意,傳回的選取項目是目前有效的選取項目。由於指令碼會對簡報進行各種變更,選取範圍也會隨之轉換,以納入這些變更。舉例來說,如果選取兩個形狀 A 和 B,然後指令碼移除形狀 B,傳回的選取物件會隱含更新,只選取形狀 A。
// Gets the current active page that is selected in the active presentation. const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage();
回攻員
Selection|null:代表使用者選取的項目,如果指令碼未繫結至簡報,或沒有有效的使用者選取項目,則為 null。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Slide By Id(id)
get Slides()
get Url()
擷取存取這份簡報的網址。
const 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
get Viewers()
取得這個 Presentation 的檢視者和加註者清單。
回攻員
User[]:具有檢視或留言權限的使用者陣列。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
insert Slide(insertionIndex)
使用根據目前主投影片的 Predefined 預先定義版面配置,在簡報中指定索引處插入投影片。目前的控制台是下列其中一個:
- 上一張投影片的母片。
- 如果 insertionIndex 為零,則為第一張投影片的母片。
- 簡報中的第一個母片 (如果沒有投影片)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
insertion | Integer | 從零開始的索引,指出要插入投影片的位置。 |
回攻員
Slide:插入的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
insert Slide(insertionIndex, layout)
使用目前的主投影片,根據指定的版面配置,在簡報中指定索引處插入投影片。目前的母項是下列其中一項:
- 上一張投影片的母片。
- 如果 insertionIndex 為零,則為第一張投影片的母片。
- 簡報中的第一個母片 (如果沒有投影片)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
insertion | Integer | 從零開始的索引,指出要插入投影片的位置。 |
layout | Layout | 新投影片要使用的版面配置,應位於目前的母片中。 |
回攻員
Slide:插入的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
insert Slide(insertionIndex, predefinedLayout)
使用目前主投影片中指定的預先定義版面配置,在簡報中指定索引處插入投影片。目前的母項是下列其中一項:
- 上一張投影片的母片。
- 如果 insertionIndex 為零,則為第一張投影片的母片。
- 簡報中的第一個母片 (如果沒有投影片)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
insertion | Integer | 從零開始的索引,指出要插入投影片的位置。 |
predefined | Predefined | 新投影片要使用的預先定義版面配置,應位於目前的主版中。 |
回攻員
Slide:插入的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
insert Slide(insertionIndex, slide)
在簡報中指定索引處插入提供的 Slide 副本。
如果複製的投影片來自其他簡報,且該簡報中沒有上層母片和版面配置頁面,系統也會一併複製。
// Copy a slide from another presentation and inserts it. const otherPresentation = SlidesApp.openById('presentationId'); const currentPresentation = SlidesApp.getActivePresentation(); const slide = otherPresentation.getSlides()[0]; const insertionIndex = 1; currentPresentation.insertSlide(insertionIndex, slide);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
insertion | Integer | 從零開始的索引,指出要插入投影片的位置。 |
slide | Slide | 要複製及插入的投影片。 |
回攻員
Slide:插入的新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
insert Slide(insertionIndex, slide, linkingMode)
將來源簡報中提供的 Slide 副本插入目前簡報的指定索引,並根據 Slide 設定投影片連結。
如果複製的投影片來自其他簡報,且目前簡報中沒有上層母片和版面配置頁面,系統也會一併複製。
如果連結模式為 Slide,當系統呼叫 Slide.refreshSlide() 時,插入的投影片可以更新為與提供的來源投影片相符。其他協作者可以查看來源投影片的連結。Slide 無法與目前簡報的來源投影片搭配使用。
// Copy a slide from another presentation, then insert and link it. const sourcePresentation = SlidesApp.openById('presentationId'); const currentPresentation = SlidesApp.getActivePresentation(); const slide = sourcePresentation.getSlides()[0]; const insertionIndex = 1; const insertedSlide = currentPresentation.insertSlide( insertionIndex, slide, SlidesApp.SlideLinkingMode.LINKED, );
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
insertion | Integer | 從零開始的索引,指出要插入投影片的位置。 |
slide | Slide | 要複製及插入的投影片。 |
linking | Slide | 要使用的連結模式。 |
回攻員
Slide:新投影片。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
remove Editor(emailAddress)
從 Presentation 的編輯者清單中移除指定使用者。如果使用者屬於具有一般存取權的使用者類別,例如 Presentation 是與使用者的整個網域共用,或是 Presentation 位於使用者可存取的共用雲端硬碟中,這個方法就無法禁止使用者存取 Presentation。
如果是雲端硬碟檔案,系統也會從檢視者清單中移除該使用者。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
email | String | 要移除的使用者電子郵件地址。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
remove Editor(user)
從 Presentation 的編輯者清單中移除指定使用者。如果使用者屬於具有一般存取權的使用者類別,例如 Presentation 是與使用者的整個網域共用,或是 Presentation 位於使用者可存取的共用雲端硬碟中,這個方法就無法禁止使用者存取 Presentation。
如果是雲端硬碟檔案,系統也會從檢視者清單中移除該使用者。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
user | User | 要移除的使用者代表。 |
回攻員
Presentation - This Presentation,用於鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
remove Viewer(emailAddress)
從 Presentation 的觀眾和留言者清單中移除指定使用者。如果使用者是編輯者,而非檢視者或留言者,這個方法不會有任何作用。如果使用者屬於具有一般存取權的使用者類別 (例如 Presentation 與使用者的整個網域共用,或 Presentation 位於使用者可存取的共用雲端硬碟中),這個方法也無法禁止使用者存取 Presentation。
如果是雲端硬碟檔案,系統也會從編輯者清單中移除使用者。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
email | String | 要移除的使用者電子郵件地址。 |
回攻員
Presentation - 這是 Presentation 的鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
remove Viewer(user)
從 Presentation 的觀眾和留言者清單中移除指定使用者。如果使用者是編輯者而非檢視者,這個方法不會生效。如果使用者屬於具有一般存取權的使用者類別 (例如 Presentation 與使用者的整個網域共用,或 Presentation 位於使用者可存取的共用雲端硬碟中),這個方法也無法禁止使用者存取 Presentation。
如果是雲端硬碟檔案,系統也會從編輯者清單中移除使用者。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
user | User | 要移除的使用者代表。 |
回攻員
Presentation - 這是 Presentation 的鏈結。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
replace All Text(findText, replaceText)
將所有符合「尋找文字」的文字例項替換為「取代文字」。搜尋時不區分大小寫。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
find | String | 要尋找的文字。 |
replace | String | 要用來取代相符文字的文字。 |
回攻員
Integer - 發生次數已變更
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
replace All Text(findText, replaceText, matchCase)
將所有符合「尋找文字」的文字例項替換為「取代文字」。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
find | String | 要尋找的文字。 |
replace | String | 要用來取代相符文字的文字。 |
match | Boolean | 如果顯示 true,搜尋時會區分大小寫;如果顯示 false,搜尋時不會區分大小寫。 |
回攻員
Integer - 發生次數已變更
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
save And Close()
儲存目前的 Presentation。導致待處理的更新遭到清除並套用。
即使指令碼執行因錯誤而終止,系統也會在每個開啟的 Presentation 指令碼執行結束時,自動叫用 save 方法。
已關閉的 Presentation 無法編輯。使用 Slides 的其中一種開啟方法,重新開啟特定簡報進行編輯。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
set Name(name)
設定簡報名稱或標題。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
name | String | 要為這份簡報設定的名稱。 |
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations