建立並開啟可編輯的 Presentations。
// Open a presentation by ID. let preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE'); // Create and open a presentation. preso = SlidesApp.create('Presentation Name');
屬性
| 屬性 | 類型 | 說明 |
|---|---|---|
Alignment | Alignment | 對齊位置類型的列舉。 |
Arrow | Arrow | 列舉 Line 可擁有的不同箭頭樣式。 |
Auto | Auto | 自動文字類型的列舉。 |
Autofit | Autofit | 自動調整類型列舉。 |
Cell | Cell | 列舉表格儲存格的不同合併狀態。 |
Color | Color | 顏色類型列舉。 |
Content | Content | 用於指定內容對齊方式的值列舉。 |
Dash | Dash | 列舉 Line 可採用的不同虛線樣式。 |
Fill | Fill | 填入類型列舉。 |
Line | Line | Line 的類別列舉。 |
Line | Line | Line 類型的列舉。 |
Line | Line | Line 類型的列舉。 |
Link | Link | 連結類型列舉。 |
List | List | 列舉清單預設集類型。 |
Page | Page | 列舉網頁背景類型。 |
Page | Page | 網頁元素類型的列舉。 |
Page | Page | 列舉頁面類型。 |
Paragraph | Paragraph | 段落對齊方式的列舉。 |
Placeholder | Placeholder | 預留位置類型的列舉。 |
Predefined | Predefined | 預先定義的版面配置列舉。 |
Selection | Selection | 選取項目類型的列舉。 |
Shape | Shape | 形狀類型的列舉。 |
Sheets | Sheets | 試算表圖表嵌入類型的列舉。 |
Slide | Slide | 列舉連結簡報的方式。 |
Slide | Slide | 列舉投影片位置類型。 |
Spacing | Spacing | 列舉間距模式類型。 |
Text | Text | 列舉文字基準線位移的類型。 |
Text | Text | 列舉文字方向的類型。 |
Theme | Theme | 主題顏色的列舉。 |
Video | Video | 影片來源類型的列舉。 |
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
create(name) | Presentation | 建立並開啟新的 Presentation。 |
get | Presentation|null | 傳回目前有效且指令碼繫結至容器的簡報,如果沒有有效簡報,則傳回 null。 |
get | Ui | 傳回簡報使用者介面環境的例項,允許指令碼新增選單、對話方塊和側欄等功能。 |
new | Affine | 傳回新的 Affine,用於建構 Affine。 |
open | Presentation | 開啟具有指定 ID 的 Presentation。 |
open | Presentation | 使用指定網址開啟 Presentation。 |
內容詳盡的說明文件
create(name)
建立並開啟新的 Presentation。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
name | String | 要為建立的簡報命名的名稱。 |
回攻員
Presentation:指定名稱的簡報。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations
get Active Presentation()
傳回目前有效且指令碼繫結至容器的簡報,如果沒有有效簡報,則傳回 null。如要與指令碼未繫結的簡報互動,請改用 open。
// Get the current presentation to which this script is bound. const presentation = SlidesApp.getActivePresentation();
回攻員
Presentation|null
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Ui()
傳回簡報使用者介面環境的例項,允許指令碼新增選單、對話方塊和側欄等功能。指令碼只能與目前開啟簡報執行個體的 UI 互動,且指令碼必須繫結至簡報。詳情請參閱選單和對話方塊與側欄指南。
// Add a custom menu to the active presentation, including a separator and a // sub-menu. function onOpen(e) { SlidesApp.getUi() .createMenu('My Menu') .addItem('My menu item', 'myFunction') .addSeparator() .addSubMenu( SlidesApp.getUi() .createMenu('My sub-menu') .addItem('One sub-menu item', 'mySecondFunction') .addItem('Another sub-menu item', 'myThirdFunction'), ) .addToUi(); }
回攻員
new Affine Transform Builder()
open By Id(id)
開啟具有指定 ID 的 Presentation。
// Open a presentation by ID. const presentation = SlidesApp.openById('docId');
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
id | String |
回攻員
Presentation:具有指定 ID 的簡報
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations
open By Url(url)
使用指定網址開啟 Presentation。
// Open a presentation by URL. const presentation = SlidesApp.openByUrl( 'https://docs.google.com/presentation/d/docId/edit', );
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
url | String |
回攻員
Presentation:指定網址的簡報
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/presentations