簡報中的主要檔案。
主頁內含所有常見網頁元素和一組版面配置的常用屬性。第三方帳戶有以下三種用途:
- 主要範本的預留位置形狀含有使用該主素材資源的網頁上所有預留位置形狀的預設文字樣式和形狀屬性。
- 主網頁的屬性會定義其版面配置沿用的共同頁面屬性。
- 無論版面配置為何,主投影片上的其他形狀都會顯示在使用該主投影片的所有投影片上。
方法
內容詳盡的說明文件
getBackground()
取得網頁的背景。
回攻員
PageBackground
:網頁的背景,
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getColorScheme()
取得與網頁相關聯的 ColorScheme
。
回攻員
ColorScheme
:網頁的色彩配置。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getGroups()
getImages()
getLayouts()
getLines()
getObjectId()
取得網頁的專屬 ID。頁面和頁面元素使用的物件 ID 會共用相同的命名空間。
回攻員
String
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
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
getPageElements()
傳回已在網頁上算繪的 PageElement
物件清單。
回攻員
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPageType()
getPlaceholder(placeholderType)
傳回指定 PlaceholderType
的預留位置 PageElement
物件;如果沒有相符的預留位置,則傳回 null
。
如果有多個相同類型的預留位置,則會傳回具有最低預留位置索引數量的預留位置。如果多個相符預留位置都具備相同索引,則會傳回網頁元素集合中的第一個預留位置。
var slide = SlidesApp.getActivePresentation().getSlides()[0]; var placeholder = slide.getPlaceholder(SlidesApp.PlaceholderType.CENTERED_TITLE);
參數
名稱 | 類型 | 說明 |
---|---|---|
placeholderType | PlaceholderType |
回攻員
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPlaceholder(placeholderType, placeholderIndex)
傳回指定 PlaceholderType
和預留位置索引的預留位置 PageElement
物件;如果沒有預留位置,則傳回 null
。
如果多個預留位置具有相同的類型和索引,則會傳回網頁元素集合中的第一個預留位置。
var slide = SlidesApp.getActivePresentation().getSlides()[0]; var placeholder = slide.getPlaceholder(SlidesApp.PlaceholderType.CENTERED_TITLE, 0);
參數
名稱 | 類型 | 說明 |
---|---|---|
placeholderType | PlaceholderType | |
placeholderIndex | Integer |
回攻員
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getPlaceholders()
傳回頁面中的預留位置 PageElement
物件清單。
var master = SlidesApp.getActivePresentation().getMasters()[0]; Logger.log('Number of placeholders in the master: ' + master.getPlaceholders().length);
回攻員
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getShapes()
getSheetsCharts()
傳回頁面上的 SheetsChart
物件清單。
回攻員
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getTables()
getVideos()
getWordArts()
group(pageElements)
將所有指定的網頁元素分組。
同一個網頁上至少應包含兩個群組內的兩個網頁元素。無法將部分網頁元素 (例如 Videos
、Tables
和 placeholder Shapes
) 分組。
參數
名稱 | 類型 | 說明 |
---|---|---|
pageElements | PageElement[] | 要歸為一組的元素。 |
回攻員
Group
:新的群組。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertGroup(group)
在頁面中插入所提供 Group
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a group between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var group = otherPresentationSlide.getGroups()[0]; currentPresentationSlide.insertGroup(group); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
group | Group | 要複製及插入的群組。 |
回攻員
Group
:插入的群組。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertImage(blobSource)
在頁面左上角插入圖片,並使用指定映像檔 blob 的預設大小。
插入圖片時,系統會從 BlobSource
擷取圖片一次,並儲存副本,以便在簡報中顯示。圖片大小不得超過 50 MB,且不得超過 2500 萬像素,且須使用 PNG、JPEG 或 GIF 格式。
var slide = SlidesApp.getActivePresentation().getSlides()[0]; // Get the Drive image file with the given ID. var image = DriveApp.getFileById(fileId); slide.insertImage(image);
參數
名稱 | 類型 | 說明 |
---|---|---|
blobSource | BlobSource | 圖片資料。 |
回攻員
Image
:插入的圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertImage(blobSource, left, top, width, height)
在網頁上插入含有指定圖片 blob 指定位置和大小的圖片。
系統會在插入時從提供的 BlobSource
擷取圖片,並儲存副本以顯示在簡報中。圖片大小不得超過 50 MB,且不得超過 2500 萬像素,並且須使用 PNG、JPEG 或 GIF 格式。
為了維持圖片的長寬比,圖片會根據提供的大小縮放並置中。
var slide = SlidesApp.getActivePresentation().getSlides()[0]; // Get the Drive image file with the given ID. var image = DriveApp.getFileById(fileId); var position = {left: 0, top: 0}; var size = {width: 300, height: 100}; slide.insertImage(image, position.left, position.top, size.width, size.height);
參數
名稱 | 類型 | 說明 |
---|---|---|
blobSource | BlobSource | 圖片資料。 |
left | Number | 圖片的水平位置,點的位置是以頁面左上角為基準。 |
top | Number | 圖片的垂直位置,以網頁左上角做為測量基準。 |
width | Number | 點的圖片寬度。 |
height | Number | 圖片的高度。 |
回攻員
Image
:插入的圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertImage(image)
在頁面中插入所提供 Image
的副本。
插入的圖片在本頁中的位置取決於來源圖片在個別網頁上的位置。
如果提供的圖片是從目前簡報中複製的預留位置,則從主要頁面或版面配置頁面沿用的屬性也會沿用插入圖片。
如果提供的圖片是從其他簡報複製而來的預留位置,則從主要頁面或版面配置頁面繼承的屬性就會從來源呈現複製到圖片中。如果複製的預留位置圖片為空白,系統就不會在目的地表示法中插入任何內容。
// Copy an image between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var image = otherPresentationSlide.getImages[0]; currentPresentationSlide.insertImage(image);
參數
名稱 | 類型 | 說明 |
---|---|---|
image | Image | 要複製及插入的圖片。 |
回攻員
Image
:插入的圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertImage(imageUrl)
在頁面左上角插入圖片,並使用提供網址的預設大小。
插入圖片時,您可以從網址擷取圖片一次,系統會儲存副本以顯示在簡報中。圖片大小不得超過 50 MB,且不得超過 2500 萬像素,且必須使用 PNG、JPEG 或 GIF 格式。
提供的網址必須可公開存取,且大小不得超過 2 KB。網址本身會與圖片一起儲存,並透過 Image.getSourceUrl()
公開。
參數
名稱 | 類型 | 說明 |
---|---|---|
imageUrl | String | 圖片網址。 |
回攻員
Image
:插入的圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertImage(imageUrl, left, top, width, height)
在網頁上插入含有指定網址位置和大小的圖片。
插入圖片時,您可以從網址擷取圖片一次,系統會儲存副本以顯示在簡報中。圖片大小不得超過 50 MB,且不得超過 2500 萬像素,且必須使用 PNG、JPEG 或 GIF 格式。
提供的網址必須可公開存取,且大小不得超過 2 KB。網址本身會與圖片一起儲存,並透過 Image.getSourceUrl()
公開。
為了維持圖片的長寬比,圖片會根據提供的大小縮放並置中。
參數
名稱 | 類型 | 說明 |
---|---|---|
imageUrl | String | 圖片網址。 |
left | Number | 圖片的水平位置,點的位置是以頁面左上角為基準。 |
top | Number | 圖片的垂直位置,以網頁左上角做為測量基準。 |
width | Number | 點的圖片寬度。 |
height | Number | 圖片的高度。 |
回攻員
Image
:插入的圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertLine(line)
在頁面中插入所提供 Line
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a line between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var line = otherPresentationSlide.getLines[0]; currentPresentationSlide.insertLine(line);
參數
名稱 | 類型 | 說明 |
---|---|---|
line | Line | 要複製及插入的行。 |
回攻員
Line
:插入的行。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertLine(lineCategory, startConnectionSite, endConnectionSite)
在連接兩個 connection sites
的頁面中插入一行。這個網頁必須包含兩個連線網站。
// Insert a line in the first slide of the presentation connecting two shapes. var slide = SlidesApp.getActivePresentation().getSlides()[0]; var shape1 = slide.insertShape(SlidesApp.ShapeType.RECTANGLE); var shape2 = slide.insertShape(SlidesApp.ShapeType.CLOUD); slide.insertLine( SlidesApp.LineCategory.BENT, shape1.getConnectionSites()[0], shape2.getConnectionSites()[1]);
參數
名稱 | 類型 | 說明 |
---|---|---|
lineCategory | LineCategory | 要插入的線條類別。 |
startConnectionSite | ConnectionSite | 線條起點要連線的連接站。 |
endConnectionSite | ConnectionSite | 線條末端要連線的連接站。 |
回攻員
Line
:插入的行。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertLine(lineCategory, startLeft, startTop, endLeft, endTop)
在頁面中插入一行。
// Insert a line in the first slide of the presentation. var slide = SlidesApp.getActivePresentation().getSlides()[0]; var startPoint = {left: 10, top: 10}; var endPoint = {left: 40, top: 40}; slide.insertLine( SlidesApp.LineCategory.STRAIGHT, startPoint.left, startPoint.top, endPoint.left, endPoint.top);
參數
名稱 | 類型 | 說明 |
---|---|---|
lineCategory | LineCategory | 要插入的線條類別。 |
startLeft | Number | 線條起點的水平位置,以頁面左上角的點為測量基準。 |
startTop | Number | 線條起點的垂直位置,以頁面左上角的點為測量基準。 |
endLeft | Number | 線條終點的水平位置,以頁面左上角的點為測量單位。 |
endTop | Number | 線條終點的垂直位置,以頁面左上角的點為測量基準。 |
回攻員
Line
:插入的行。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertPageElement(pageElement)
在頁面中插入所提供 PageElement
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a page element between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var pageElement = otherPresentationSlide.getPageElements()[0]; // Also available for Layout, Master, and Page. currentPresentationSlide.insertPageElement(pageElement);
參數
名稱 | 類型 | 說明 |
---|---|---|
pageElement | PageElement | 要複製及插入的網頁元素。 |
回攻員
PageElement
:插入的網頁元素。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertShape(shape)
在頁面中插入所提供 Shape
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a shape between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var shape = otherPresentationSlide.getShapes[0]; currentPresentationSlide.insertShape(shape); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
shape | Shape | 要複製及插入的形狀。 |
回攻員
Shape
:插入的形狀。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertShape(shapeType)
在頁面上插入形狀。
系統會在頁面的左上角插入預設大小的形狀。
// Insert a shape in the first slide of the presentation. var slide = SlidesApp.getActivePresentation().getSlides()[0]; // Also available for Layout, Master, and Page. slide.insertShape(SlidesApp.ShapeType.RECTANGLE);
參數
名稱 | 類型 | 說明 |
---|---|---|
shapeType | ShapeType | 要插入的形狀類型。 |
回攻員
Shape
:插入的形狀。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertShape(shapeType, left, top, width, height)
insertSheetsChart(sourceChart)
在頁面上插入 Google 試算表圖表。
系統會在頁面左上角插入預設大小的圖表。
插入的圖表會與來源 Google 試算表圖表連結,以便更新。其他協作者也可以看到來源試算表的連結。
var sheet = SpreadsheetApp.openById('spreadsheetId').getSheets()[0]; var chart = sheet.getCharts()[0]; // Insert the spreadsheet chart in the first slide. var slide = SlidesApp.getActivePresentation().getSlides()[0]; slide.insertSheetsChart(chart);
參數
名稱 | 類型 | 說明 |
---|---|---|
sourceChart | EmbeddedChart | 要插入頁面中的圖表。 |
回攻員
SheetsChart
:頁面中插入的圖表。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSheetsChart(sourceChart, left, top, width, height)
在網頁上插入 Google 試算表圖表,並提供指定的位置和大小。
為了維持圖表的長寬比,系統會根據所提供的大小縮放圖表並置中。
插入的圖表會與來源 Google 試算表圖表連結,以便更新。其他協作者也可以看到來源試算表的連結。
var sheet = SpreadsheetApp.openById('spreadsheetId').getSheets()[0]; var chart = sheet.getCharts()[0]; // Insert the spreadsheet chart in the first slide. var slide = SlidesApp.getActivePresentation().getSlides()[0]; var position = {left: 0, top: 0}; var size = {width: 200, height: 200}; // Also available for Layout, Master, and Page. slide.insertSheetsChart( chart, position.left, position.top, size.width, size.height);
參數
名稱 | 類型 | 說明 |
---|---|---|
sourceChart | EmbeddedChart | 要插入頁面中的圖表。 |
left | Number | 圖表的水平位置,以頁面左上角做為測量基準。 |
top | Number | 圖表的垂直位置,以頁面左上角為測量基準。 |
width | Number | 圖表的寬度,以點表示。 |
height | Number | 圖表的高度,以點表示。 |
回攻員
SheetsChart
:頁面中插入的圖表。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSheetsChart(sheetsChart)
在頁面中插入所提供 SheetsChart
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a sheets chart between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var sheetsChart = otherPresentationSlide.getSheetsCharts[0]; // Also available for Layout, Master, and Page. currentPresentationSlide.insertSheetsChart(sheetsChart);
參數
名稱 | 類型 | 說明 |
---|---|---|
sheetsChart | SheetsChart | 要複製及插入的工作表圖表。 |
回攻員
SheetsChart
:插入的工作表圖表。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSheetsChartAsImage(sourceChart)
在網頁上以 Image
格式插入 Google 試算表圖表。
系統會在頁面的左上角插入圖表圖片,並採用預設大小。
插入的圖表圖片未連結至來源 Google 試算表圖表。
var sheet = SpreadsheetApp.openById('spreadsheetId').getSheets()[0]; var chart = sheet.getCharts()[0]; // Insert the spreadsheet chart in the first slide. var slide = SlidesApp.getActivePresentation().getSlides()[0]; slide.insertSheetsChartAsImage(chart); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
sourceChart | EmbeddedChart | 要插入頁面中的圖表。 |
回攻員
Image
:在頁面中插入的圖表圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertSheetsChartAsImage(sourceChart, left, top, width, height)
在網頁上以 Image
格式插入 Google 試算表圖表,並提供指定的位置和大小。
為了維持圖表圖片的長寬比,系統會配合提供的大小縮放圖片並置中。
插入的圖表圖片並未與來源 Google 試算表圖表建立連結。
var sheet = SpreadsheetApp.openById('spreadsheetId').getSheets()[0]; var chart = sheet.getCharts()[0]; // Insert the spreadsheet chart in the first slide. var slide = SlidesApp.getActivePresentation().getSlides()[0]; var position = {left: 0, top: 0}; var size = {width: 200, height: 200}; // Also available for Layout, Master, and Page. slide.insertSheetsChartAsImage( chart, position.left, position.right, size.width, size.height);
參數
名稱 | 類型 | 說明 |
---|---|---|
sourceChart | EmbeddedChart | 要插入頁面中的圖表。 |
left | Number | 圖表的水平位置,以頁面左上角做為測量基準。 |
top | Number | 圖表的垂直位置,以頁面左上角為測量基準。 |
width | Number | 圖表的寬度,以點表示。 |
height | Number | 圖表的高度,以點表示。 |
回攻員
Image
:在頁面中插入的圖表圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertTable(numRows, numColumns)
insertTable(numRows, numColumns, left, top, width, height)
在頁面中插入含有指定位置和大小的表格。
列和欄會平均分配給建立的資料表。
參數
名稱 | 類型 | 說明 |
---|---|---|
numRows | Integer | 資料表中的資料列數。 |
numColumns | Integer | 表格中的欄數。 |
left | Number | 表格的水平位置,從頁面左上角測量。 |
top | Number | 表格的垂直位置,從網頁左上角開始測量。 |
width | Number | 表格的寬度。 |
height | Number | 表格的最小高度。算繪資料表的實際高度取決於文字字型大小等因素。 |
回攻員
Table
:插入的資料表。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertTable(table)
在頁面中插入所提供 Table
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a table between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var table = otherPresentationSlide.getTables[0]; currentPresentationSlide.insertTable(table); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
table | Table | 要複製及插入的資料表。 |
回攻員
Table
:插入的資料表。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertTextBox(text)
在網頁上插入包含所提供字串的文字方塊 Shape
。
系統會在網頁的左上角插入預設大小的文字方塊形狀。
// Insert text box with "Hello" on the first slide of presentation. var slide = SlidesApp.getActivePresentation().getSlides()[0]; slide.insertTextBox('Hello'); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
text | String | 文字方塊形狀應包含的字串。 |
回攻員
Shape
:插入的文字方塊形狀。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertTextBox(text, left, top, width, height)
在網頁上插入包含所提供字串的文字方塊 Shape
。
// Insert text box with "Hello" on the first slide of presentation. This text box is a square // with a length of 10 points on each side. var slide = SlidesApp.getActivePresentation().getSlides()[0]; slide.insertTextBox('Hello', 0, 0, 10, 10); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
text | String | 文字方塊形狀應包含的字串。 |
left | Number | 文字方塊形狀的水平位置 (從頁面左上角測量)。 |
top | Number | 文字方塊形狀的垂直位置 (從頁面左上角測量)。 |
width | Number | 文字方塊形狀的寬度。 |
height | Number | 文字方塊形狀的高度。 |
回攻員
Shape
:插入的文字方塊形狀。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertVideo(videoUrl)
insertVideo(videoUrl, left, top, width, height)
在網頁上插入含有指定位置和大小的影片。
目前僅支援 YouTube 影片。
參數
名稱 | 類型 | 說明 |
---|---|---|
videoUrl | String | 要插入的影片網址。 |
left | Number | 影片的水平位置,以頁面左上角做為測量基準。 |
top | Number | 影片的垂直位置,以網頁左上角做為測量基準。 |
width | Number | 影片的寬度,以點為單位。 |
height | Number | 影片的高度。 |
回攻員
Video
:插入的影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertVideo(video)
在頁面中插入所提供 Video
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a video between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var video = otherPresentationSlide.getVideos[0]; currentPresentationSlide.insertVideo(video); // Also available for Layout, Master, and Page.
參數
名稱 | 類型 | 說明 |
---|---|---|
video | Video | 要複製及插入的影片。 |
回攻員
Video
:插入的影片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
insertWordArt(wordArt)
在頁面中插入所提供 WordArt
的副本。
在此網頁上插入元素的位置,取決於來源元素在個別網頁上的位置。
如果提供的元素是從目前簡報中複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性也會沿用已插入的元素。
如果提供的元素是從其他呈現方式複製而來的預留位置,從主要頁面或版面配置頁面沿用的屬性就會從來源呈現複製到元素中。
// Copy a word art between presentations. var otherPresentationSlide = SlidesApp.openById('presentationId').getSlides()[0]; var currentPresentationSlide = SlidesApp.getActivePresentation().getSlides()[0]; var wordArt = otherPresentationSlide.getWordArts[0]; // Also available for Layout, Master, and Page. currentPresentationSlide.insertWordArt(wordArt);
參數
名稱 | 類型 | 說明 |
---|---|---|
wordArt | WordArt | 要複製及插入的群組。 |
回攻員
WordArt
— 插入的文字藝術。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
remove()
移除網頁。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
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
selectAsCurrentPage()
在進行中的簡報中選取 Page
做為 current page selection
,並移除先前的所有選取項目。
指令碼只有在指令碼繫結至簡報時,才能存取執行指令碼的使用者選取項目。
// Select the first slide as the current page selection and replace any previous selection. var slide = SlidesApp.getActivePresentation().getSlides()[0]; slide.selectAsCurrentPage(); // Also available for Layout, Master, and Page.
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations