Class Image

圖片

代表圖片的 PageElement

方法

方法傳回類型簡短說明
alignOnPage(alignmentPosition)Image將元素對齊頁面指定的對齊位置。
bringForward()Image將頁面元素往前移動一個元素。
bringToFront()Image將網頁元素移到網頁前方。
duplicate()PageElement複製頁面元素。
getAs(contentType)Blob以 blob 的形式傳回這個物件中的資料,做為轉換成指定內容類型的 blob。
getBlob()Blob以 blob 形式傳回這張圖片中的資料。
getBorder()Border傳回圖片的 Border
getConnectionSites()ConnectionSite[]傳回頁面元素上的 ConnectionSite 清單;如果是網頁,則傳回空白清單 元素沒有任何連接網站。
getContentUrl()String取得圖片的網址。
getDescription()String傳回頁面元素的替代文字說明。
getHeight()Number取得元素的高度 (以點為單位),也就是當 元素沒有旋轉角度。
getInherentHeight()Number傳回元素的固有高度 (以點為單位)。
getInherentWidth()Number傳回元素在點的固有寬度。
getLeft()Number傳回元素的水平位置 (以點的為單位,從 顯示網頁。
getLink()Link如果沒有連結,則傳回 Linknull
getObjectId()String傳回此物件的專屬 ID。
getPageElementType()PageElementType傳回頁面元素的類型,以 PageElementType 列舉表示。
getParentGroup()Group傳回此頁面元素所屬的群組,或傳回 null (如果元素不在 群組。
getParentPage()Page傳回這個頁面元素所在的頁面。
getParentPlaceholder()PageElement傳回預留位置的父項頁面元素。
getPlaceholderIndex()Integer傳回預留位置圖片的索引。
getPlaceholderType()PlaceholderType傳回圖片的預留位置類型;如果形狀不是形狀,則傳回 PlaceholderType.NONE 預留位置。
getRotation()Number傳回元素的中心以度為單位的順時針旋轉角度,其中 0 度 也意味著沒有輪播
getSourceUrl()String取得圖片的來源網址 (如有)。
getTitle()String傳回頁面元素的替代文字標題。
getTop()Number從頁面左上角取得元素的垂直位置 表示元素未旋轉時
getTransform()AffineTransform傳回頁面元素的轉換。
getWidth()Number傳回元素的寬度,也就是元素邊界方塊的寬度 則該元素不會旋轉。
preconcatenateTransform(transform)Image將提供的轉換預先串連成頁面元素的現有轉換。
remove()void移除網頁元素。
removeLink()void移除 Link
replace(blobSource)Image將這張圖片替換為 BlobSource 物件描述的圖片。
replace(blobSource, crop)Image將這張圖片取代為 Image 物件描述的圖片,並可選擇是否要裁剪 調整圖片尺寸
replace(imageUrl)Image以指定網址下載的其他圖片取代這張圖片。
replace(imageUrl, crop)Image以所提供網址下載的其他圖片取代這張圖片,並且可以選擇是否要裁剪 調整圖片尺寸
scaleHeight(ratio)Image根據指定的比例縮放元素的高度。
scaleWidth(ratio)Image根據指定的比例縮放元素的寬度。
select()void僅選取使用中的簡報中的 PageElement,並移除先前使用中的任何文件 。
select(replace)void選取目前簡報中的PageElement
sendBackward()Image讓頁面元素回到頁面中的一個元素。
sendToBack()Image將網頁元素傳送至網頁背面。
setDescription(description)Image設定頁面元素的替代文字說明。
setHeight(height)Image設定元素的高度 (以點為單位),也就是當 元素沒有旋轉角度。
setLeft(left)Image設定元素的水平位置 (以點的為單位,從 顯示網頁。
setLinkSlide(slideIndex)Link使用投影片的索引 (從零開始計算),將 Link 設為指定的 Slide
setLinkSlide(slide)LinkLink 設為指定的 Slide,連結由指定的投影片 ID 設定。
setLinkSlide(slidePosition)Link使用投影片的相對位置,將 Link 設為指定的 Slide
setLinkUrl(url)LinkLink 設為指定的非空白網址字串。
setRotation(angle)Image設定元素的順時針旋轉角度,以度為單位。
setTitle(title)Image設定頁面元素的替代文字標題。
setTop(top)Image設定元素的垂直位置 (從頁面左上角開始計算) 表示元素未旋轉時
setTransform(transform)Image使用提供的轉換設定頁面元素的轉換。
setWidth(width)Image設定元素的寬度 (以點為單位),也就是當 元素沒有旋轉角度。

內容詳盡的說明文件

alignOnPage(alignmentPosition)

將元素對齊頁面指定的對齊位置。

參數

名稱類型說明
alignmentPositionAlignmentPosition此頁面元素在網頁上的對齊位置。

回攻員

Image:此頁面元素,用於鏈結。


bringForward()

將頁面元素往前移動一個元素。

網頁元素不得位於群組中。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

bringToFront()

將網頁元素移到網頁前方。

網頁元素不得位於群組中。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

duplicate()

複製頁面元素。

將重複的頁面元素放在與原始頁面位於相同位置的頁面。

回攻員

PageElement:這個頁面元素的新副本。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getAs(contentType)

以 blob 的形式傳回這個物件中的資料,做為轉換成指定內容類型的 blob。這個 方法會在檔案名稱中加入適當的副檔名,例如「myfile.pdf」。不過 假設檔案名稱最後一個句點 (如果有) 之後的部分為現有文件 所有應替換的副檔名。因此,「ShoppingList.12.25.2014」變成 「ShoppingList.12.25.pdf」。

如要查看轉換的每日配額,請參閱 Google 的配額 服務。新建立的 Google Workspace 網域可能會暫時受到更嚴格的限制

參數

名稱類型說明
contentTypeString要轉換的 MIME 類型。大多數 blob 的 'application/pdf' 是 就是唯一有效的選項如為 BMP、GIF、JPEG 或 PNG 格式的圖片,也應採用 'image/bmp''image/gif''image/jpeg''image/png' 格式 有效。如果是 Google 文件,'text/markdown' 也是有效的格式。

回攻員

Blob - 做為 blob 的資料。


getBlob()

以 blob 形式傳回這張圖片中的資料。

回攻員

Blob:做為 blob 的圖片資料。


getBorder()

傳回圖片的 Border

回攻員

Border:圖片的邊框。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getConnectionSites()

傳回頁面元素上的 ConnectionSite 清單;如果是網頁,則傳回空白清單 元素沒有任何連接網站。

回攻員

ConnectionSite[]:連線網站清單,如果這個元素沒有連線網站,則不會顯示任何內容。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getContentUrl()

取得圖片的網址。

系統已針對要求者的帳戶標記這個網址,因此任何知道網址的使用者都能有效利用 會以原始要求者的身分存取圖片。如果 變更簡報的共用設定。傳回的網址會在一段時間後失效。

回攻員

String

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getDescription()

傳回頁面元素的替代文字說明。說明會與 顯示和讀取替代文字

回攻員

String:頁面元素的替代文字說明。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getHeight()

取得元素的高度 (以點為單位),也就是當 元素沒有旋轉角度。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

回攻員

Number — 網頁元素在點中的固有高度,或 null 如果網頁元素包含 沒有高度

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getInherentHeight()

傳回元素的固有高度 (以點為單位)。

頁面元素的轉換與原本大小相對關係。使用內部大小 結合元素的轉換,以決定元素最終的視覺外觀。

回攻員

Number — 網頁元素在點中的固有高度,或 null 如果網頁元素包含 沒有高度

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getInherentWidth()

傳回元素在點的固有寬度。

頁面元素的轉換相對於本身大小。使用內部大小 結合元素的轉換,以決定元素最終的視覺外觀。

回攻員

Number — 網頁元素固有的寬度,或 null 如果網頁元素包含 沒有寬度

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getLeft()

傳回元素的水平位置 (以點的為單位,從 顯示網頁。

回攻員

Number:此元素的水平位置 (從頁面左上角算起)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

如果沒有連結,則傳回 Linknull

var link = shape.getLink();
if (link != null) {
  Logger.log('Shape has a link of type: ' + link.getLinkType());
}

回攻員

Link

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getObjectId()

傳回此物件的專屬 ID。網頁和網頁元素所使用的物件 ID 不在相同的命名空間中

回攻員

String:此物件的專屬 ID。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getPageElementType()

傳回頁面元素的類型,以 PageElementType 列舉表示。

回攻員

PageElementType:頁面元素的類型。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParentGroup()

傳回此頁面元素所屬的群組,或傳回 null (如果元素不在 群組。

回攻員

Group:網頁元素所屬的群組,或 null

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParentPage()

傳回這個頁面元素所在的頁面。

回攻員

Page - 含有此元素的網頁。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParentPlaceholder()

傳回預留位置的父項頁面元素。如果圖片並非圖片,則傳回 null 預留位置或無父項。

回攻員

PageElement:這個圖片預留位置的上層頁面元素;如果這張圖片不是圖片,則設為 null 或沒有父項或無父項

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getPlaceholderIndex()

傳回預留位置圖片的索引。如果同一網頁上有兩張以上的預留位置圖片 是相同類型,兩者都有專屬的索引值。如果圖片不是,則傳回 null 預留位置。

回攻員

Integer:這張圖片的預留位置索引;如果圖片不是預留位置,則為 null

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getPlaceholderType()

傳回圖片的預留位置類型;如果形狀不是形狀,則傳回 PlaceholderType.NONE 預留位置。

回攻員

PlaceholderType:這張圖片的預留位置類型。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getRotation()

傳回元素的中心以度為單位的順時針旋轉角度,其中 0 度 也意味著沒有輪播

回攻員

Number:以度為單位的旋轉角度,範圍介於 0 (含) 和 360 (不含) 之間。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getSourceUrl()

取得圖片的來源網址 (如有)。

使用網址插入圖片時,系統會傳回圖片插入時提供的網址。

回攻員

String:圖片網址或 null (如果圖片沒有來源網址)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getTitle()

傳回頁面元素的替代文字標題。標題會與說明結合 顯示和讀取替代文字

回攻員

String:頁面元素的替代文字標題。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getTop()

從頁面左上角取得元素的垂直位置 表示元素未旋轉時

回攻員

Number:此元素的垂直位置,從頁面左上角開始。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getTransform()

傳回頁面元素的轉換。

頁面元素的外觀取決於絕對轉換。目的地: 計算絕對轉換,使用轉換將頁面元素的轉換預先串連起來 所有上層群組如果網頁元素不在群組中,則此元素的絕對轉換 與這個欄位中的值相同

回攻員

AffineTransform:頁面元素的轉換。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getWidth()

傳回元素的寬度,也就是元素邊界方塊的寬度 則該元素不會旋轉。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

回攻員

Number — 網頁元素固有的寬度,或 null 如果網頁元素包含 沒有寬度

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

preconcatenateTransform(transform)

將提供的轉換預先串連成頁面元素的現有轉換。

newTransform = argument * existingTransform

舉例來說,如要將頁面元素往左移動 36 指向左:

element.preconcatenateTransform(SlidesApp.newAffineTransformBuilder()
    .setTranslateX(-36.0)
    .build());

您也可以使用 setTransform(transform) 取代頁面元素的轉換。

參數

名稱類型說明
transformAffineTransform轉換至此頁面元素轉換的轉換。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

remove()

移除網頁元素。

移除作業之後,如果 Group 只包含一或多個網頁元素, 群組本身也會移除

如果從主版面配置或版面配置中移除預留位置 PageElement,則任何空白沿用機制 預留位置。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

移除 Link

shape.removeLink();

replace(blobSource)

將這張圖片替換為 BlobSource 物件描述的圖片。

插入圖片後,系統會從 擷取圖片 BlobSource 之後,系統會儲存一份副本在簡報中顯示。 圖片大小不得超過 50 MB、不得超過 2500 萬像素,且大小必須為 PNG、JPEG 或 GIF 格式。

為了維持圖片的顯示比例,圖片會隨時間縮放並置中 調整現有圖片的大小

var image = SlidesApp.getActivePresentation().getSlides()[0].getImages()[0];
// Get the Drive image file with the given ID.
var driveImage = DriveApp.getFileById(fileId);
image.replace(driveImage);

參數

名稱類型說明
blobSourceBlobSource圖片資料。

回攻員

Image:替換後的Image

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

replace(blobSource, crop)

將這張圖片取代為 Image 物件描述的圖片,並可選擇是否要裁剪 調整圖片尺寸

插入圖片後,系統會從 擷取圖片 BlobSource 之後,系統會儲存一份副本在簡報中顯示。 圖片大小不得超過 50 MB、不得超過 2500 萬像素,且大小必須為 PNG、JPEG 或 GIF 格式。

var image = SlidesApp.getActivePresentation().getSlides()[0].getImages()[0];
// Get the Drive image file with the given ID.
var driveImage = DriveApp.getFileById(fileId);
// Replace and crop the drive image.
image.replace(driveImage, true);

參數

名稱類型說明
blobSourceBlobSource圖片資料。
cropBoolean如果設為 true,請根據現有圖片大小裁剪圖片。否則, 圖片會縮放並置中

回攻員

Image:替換後的Image

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

replace(imageUrl)

以指定網址下載的其他圖片取代這張圖片。

插入圖片後,系統會從網址擷取圖片,並將副本儲存成 簡報圖片大小不得超過 50 MB、不得超過 2500 萬像素,且大小不可超過 PNG、JPEG 或 GIF 格式

提供的網址必須可公開存取,且大小不得超過 2 KB。已儲存網址本身 方法是使用映像檔並透過 getSourceUrl() 公開。

為了維持圖片的顯示比例,圖片會隨時間縮放並置中 調整現有圖片的大小

參數

名稱類型說明
imageUrlString圖片的下載網址。

回攻員

Image:替換後的Image

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

replace(imageUrl, crop)

以所提供網址下載的其他圖片取代這張圖片,並且可以選擇是否要裁剪 調整圖片尺寸

插入圖片後,系統會從網址擷取圖片,並將副本儲存成 簡報圖片大小不得超過 50 MB、不得超過 2500 萬像素,且大小不可超過 PNG、JPEG 或 GIF 格式

提供的網址不得超過 2 KB。

參數

名稱類型說明
imageUrlString圖片的下載網址。
cropBoolean如果設為 true,請根據現有圖片大小裁剪圖片。否則, 圖片會縮放並置中

回攻員

Image:替換後的Image

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

scaleHeight(ratio)

根據指定的比例縮放元素的高度。元素的高度是指元素的高度 定界框。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

參數

名稱類型說明
ratioNumber此頁面元素高度的縮放比例。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

scaleWidth(ratio)

根據指定的比例縮放元素的寬度。元素的寬度是指 定界框。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

參數

名稱類型說明
ratioNumber此頁面元素寬度的縮放比例。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

select()

僅選取使用中的簡報中的 PageElement,並移除先前使用中的任何文件 。這與使用 true 呼叫 select(replace) 相同。

指令碼只能存取執行該指令碼的使用者所選取的項目,而且 指令碼會繫結至簡報。

這會將 PageElement 的父項 Page 設為 current page selection

var slide = SlidesApp.getActivePresentation().getSlides()[0];
var pageElement = slide.getPageElements()[0];
// Only select this page element and replace any previous selection.
pageElement.select();

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

select(replace)

選取目前簡報中的PageElement

指令碼只能存取執行該指令碼的使用者所選取的項目,而且 指令碼會繫結至簡報。

true 傳遞至這個方法,即可僅選取 PageElement,並移除任何 先前的選項這也會將 PageElement 的父項 Page 設為 current page selection

傳遞 false 以選取多個 PageElement 物件。PageElement 物件必須位於同一個 Page

使用 false 選取網頁元素時,必須符合下列條件 參數:

  1. PageElement 物件的父項 Page 必須是 current page selection
  2. 請勿選取多個 Page 物件。

為確保這是我們建議的做法,請選取父項 Page 使用 Page.selectAsCurrentPage(),然後選取該網頁中的頁面元素

var slide = SlidesApp.getActivePresentation().getSlides()[0];
// First select the slide page, as the current page selection.
slide.selectAsCurrentPage();
// Then select all the page elements in the selected slide page.
var pageElements = slide.getPageElements();
for (var i = 0; i < pageElements.length; i++) {
  pageElements[i].select(false);
}

參數

名稱類型說明
replaceBoolean如果是 true,所選範圍會取代先前選取的項目;否則, 就會加進先前選取的項目中

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

sendBackward()

讓頁面元素回到頁面中的一個元素。

網頁元素不得位於群組中。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

sendToBack()

將網頁元素傳送至網頁背面。

網頁元素不得位於群組中。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setDescription(description)

設定頁面元素的替代文字說明。

Group 元素不支援該方法。

// Set the first page element's alt text description to "new alt text description".
var pageElement = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0];
pageElement.setDescription('new alt text description');
Logger.log(pageElement.getDescription());

參數

名稱類型說明
descriptionString用來設定替代文字說明的字串。

回攻員

Image:這個網頁元素。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setHeight(height)

設定元素的高度 (以點為單位),也就是當 元素沒有旋轉角度。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

參數

名稱類型說明
heightNumber此頁面元素要設定的新高度 (以點表示)。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setLeft(left)

設定元素的水平位置 (以點的為單位,從 顯示網頁。

參數

名稱類型說明
leftNumber要設定的新水平位置,以點表示。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setLinkSlide(slideIndex)

使用投影片的索引 (從零開始計算),將 Link 設為指定的 Slide

// Set a link to the first slide of the presentation.
shape.setLinkSlide(0);

參數

名稱類型說明
slideIndexInteger投影片從零開始的索引。

回攻員

Link:設定的 Link

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setLinkSlide(slide)

Link 設為指定的 Slide,連結由指定的投影片 ID 設定。

// Set a link to the first slide of the presentation.
var slide = presentation.getSlides()[0];
shape.setLinkSlide(slide);

參數

名稱類型說明
slideSlide要連結的 Slide

回攻員

Link:設定的 Link

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setLinkSlide(slidePosition)

使用投影片的相對位置,將 Link 設為指定的 Slide

// Set a link to the first slide of the presentation.
shape.setLinkSlide(SlideApp.SlidePosition.FIRST_SLIDE);

參數

名稱類型說明
slidePositionSlidePosition相對 SlidePosition

回攻員

Link:設定的 Link

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setLinkUrl(url)

Link 設為指定的非空白網址字串。

// Set a link to the URL.
shape.setLinkUrl("https://slides.google.com");

參數

名稱類型說明
urlString網址字串。

回攻員

Link:設定的 Link

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setRotation(angle)

設定元素的順時針旋轉角度,以度為單位。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

參數

名稱類型說明
angleNumber要設定的新順時針旋轉角度,以度為單位。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setTitle(title)

設定頁面元素的替代文字標題。

Group 元素不支援該方法。

// Set the first page element's alt text title to "new alt text title".
var pageElement = SlidesApp.getActivePresentation().getSlides()[0].getPageElements()[0];
pageElement.setTitle('new alt text title');
Logger.log(pageElement.getTitle());

參數

名稱類型說明
titleString要設定替代文字標題的字串。

回攻員

Image:這個網頁元素。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setTop(top)

設定元素的垂直位置 (從頁面左上角開始計算) 表示元素未旋轉時

參數

名稱類型說明
topNumber要設定的新垂直位置 (以點為單位)。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setTransform(transform)

使用提供的轉換設定頁面元素的轉換。

更新群組轉換會變更 進而變更視覺外觀

更新群組中的網頁元素轉換只會變更 該網頁元素這不會影響群組或 群組。

如要進一步瞭解轉換如何影響頁面元素視覺外觀,請參閱 getTransform()

參數

名稱類型說明
transformAffineTransform為這個頁面元素設定的轉換。

回攻員

Image:這個元素是用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setWidth(width)

設定元素的寬度 (以點為單位),也就是當 元素沒有旋轉角度。

這個方法不適用於所有網頁元素。瞭解有哪些網頁元素 請參閱 大小和位置限制。

參數

名稱類型說明
widthNumber此頁面元素要設定的新寬度 (以點表示)。

回攻員

Image:此頁面元素,用於鏈結。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations