建立並開啟可編輯的 Presentations
。
// Open a presentation by ID. var preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE'); // Create and open a presentation. preso = SlidesApp.create('Presentation Name');
屬性
屬性 | 類型 | 說明 |
---|---|---|
AlignmentPosition | AlignmentPosition | 對齊位置的列舉類型。 |
ArrowStyle | ArrowStyle | 此屬性列舉了 Line 可以擁有的不同箭頭樣式。 |
AutoTextType | AutoTextType | 自動文字類型列舉。 |
AutofitType | AutofitType | 自動調整類型的列舉。 |
CellMergeState | CellMergeState | 此項目列舉了表格中儲存格的不同合併狀態。 |
ColorType | ColorType | 顏色類型的列舉。 |
ContentAlignment | ContentAlignment | 用來指定內容對齊值的值列舉。 |
DashStyle | DashStyle | Line 可以擁有的不同破折號樣式列舉。 |
FillType | FillType | 填充類型列舉。 |
LineCategory | LineCategory | Line 類別的列舉。 |
LineFillType | LineFillType | LineFill 類型的列舉。 |
LineType | LineType | Line 類型的列舉。 |
LinkType | LinkType | 連結類型列舉。 |
ListPreset | ListPreset | 清單預設類型列舉。 |
PageBackgroundType | PageBackgroundType | 網頁背景類型列舉。 |
PageElementType | PageElementType | 此屬性列舉了網頁元素類型。 |
PageType | PageType | 網頁類型列舉。 |
ParagraphAlignment | ParagraphAlignment | 段落對齊類型列舉。 |
PlaceholderType | PlaceholderType | 預留位置類型的列舉。 |
PredefinedLayout | PredefinedLayout | 預先定義版面配置的列舉。 |
SelectionType | SelectionType | 選項類型的列舉。 |
ShapeType | ShapeType | 列舉形狀類型。 |
SheetsChartEmbedType | SheetsChartEmbedType | 試算表圖表嵌入類型列舉。 |
SlideLinkingMode | SlideLinkingMode | 簡報的連結方式列舉。 |
SlidePosition | SlidePosition | 投影片位置類型列舉。 |
SpacingMode | SpacingMode | 間距模式類型列舉。 |
TextBaselineOffset | TextBaselineOffset | 文字基準偏移類型列舉。 |
TextDirection | TextDirection | 文字路線類型列舉的列舉。 |
ThemeColorType | ThemeColorType | 主題顏色列舉。 |
VideoSourceType | VideoSourceType | 影片來源類型的列舉。 |
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
create(name) | Presentation | 建立並開啟新的 Presentation 。 |
getActivePresentation() | Presentation | 傳回指令碼為 container-bound 目前使用中的呈現方式;如果沒有使用中的呈現,則傳回 null 。 |
getUi() | Ui | 傳回簡報使用者介面環境的例項,讓指令碼能夠新增選單、對話方塊和側欄等功能。 |
newAffineTransformBuilder() | AffineTransformBuilder | 傳回新的 AffineTransformBuilder 以建構 AffineTransform 。 |
openById(id) | Presentation | 開啟具有指定 ID 的 Presentation 。 |
openByUrl(url) | Presentation | 使用指定網址開啟 Presentation 。 |
內容詳盡的說明文件
create(name)
建立並開啟新的 Presentation
。
參數
名稱 | 類型 | 說明 |
---|---|---|
name | String | 所建立簡報的命名名稱。 |
回攻員
Presentation
:具有指定名稱的簡報。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations
getActivePresentation()
傳回指令碼為 container-bound 目前使用中的呈現方式;如果沒有使用中的呈現,則傳回 null
。如要與指令碼未繫結的呈現方式互動,請改用 openById(id)
。
// Get the current presentation to which this script is bound. var presentation = SlidesApp.getActivePresentation();如果簡報已開啟,系統會傳回同一個呈現例項。
回攻員
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getUi()
傳回簡報使用者介面環境的例項,讓指令碼能夠新增選單、對話方塊和側欄等功能。指令碼只能在已開啟簡報的目前執行個體中與 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(); }
回攻員
newAffineTransformBuilder()
openById(id)
開啟具有指定 ID 的 Presentation
。
// Open a presentation by ID. var presentation = SlidesApp.openById('docId');如果簡報已開啟,系統會傳回同一個呈現例項。
參數
名稱 | 類型 | 說明 |
---|---|---|
id | String |
回攻員
Presentation
:具有指定 ID 的簡報
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations
openByUrl(url)
使用指定網址開啟 Presentation
。
// Open a presentation by URL. var presentation = SlidesApp.openByUrl('https://docs.google.com/presentation/d/docId/edit');如果簡報已開啟,系統會傳回同一個呈現例項。
參數
名稱 | 類型 | 說明 |
---|---|---|
url | String |
回攻員
Presentation
:含有指定網址的簡報
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations