Class Line

Line (行列)

代表線條的 PageElement

方法

方法傳回類型簡短說明
alignOnPage(alignmentPosition)Line將元素對齊頁面指定的對齊位置。
bringForward()Line將頁面元素往前移動一個元素。
bringToFront()Line將網頁元素移到網頁前方。
duplicate()PageElement複製頁面元素。
getConnectionSites()ConnectionSite[]傳回網頁元素上的 ConnectionSite 清單;如果網頁元素沒有任何連線網站,則傳回空白清單。
getDashStyle()DashStyle取得線條的 DashStyle
getDescription()String傳回頁面元素的替代文字說明。
getEnd()Point傳回線條的終點 (從頁面左上角開始計算)。
getEndArrow()ArrowStyle取得線條終點的 ArrowStyle 箭頭。
getEndConnection()ConnectionSite在線條末端傳回連線;如果沒有連線,則傳回 null
getHeight()Number取得元素的高度 (以點為單位),也就是元素未旋轉時,元素的定界框高度。
getInherentHeight()Number傳回元素的固有高度 (以點為單位)。
getInherentWidth()Number傳回元素在點的固有寬度。
getLeft()Number傳回元素的水平位置 (以點為單位)。當元素沒有旋轉時,從頁面左上角測量。
getLineCategory()LineCategory取得線條的 LineCategory
getLineFill()LineFill取得線條的 LineFill
getLineType()LineType取得線條的 LineType
getLink()Link如果沒有連結,則傳回 Linknull
getObjectId()String傳回此物件的專屬 ID。
getPageElementType()PageElementType傳回頁面元素的類型,以 PageElementType 列舉表示。
getParentGroup()Group傳回此頁面元素所屬的群組;如果元素不在群組中,則傳回 null
getParentPage()Page傳回這個頁面元素所在的頁面。
getRotation()Number傳回元素中心以度為單位的順時針旋轉角度,零度表示不會旋轉。
getStart()Point傳回線條的起點 (從頁面左上角開始計算)。
getStartArrow()ArrowStyle取得行開頭的箭頭 ArrowStyle
getStartConnection()ConnectionSite傳回行開頭的連線;如果沒有連線,則傳回 null
getTitle()String傳回頁面元素的替代文字標題。
getTop()Number取得元素的垂直位置 (在元素沒有旋轉時從頁面左上角測量)。
getTransform()AffineTransform傳回頁面元素的轉換。
getWeight()Number傳回點中線條的粗細。
getWidth()Number傳回元素的寬度 (以點為單位),也就是元素未旋轉時,元素的定界框寬度。
isConnector()Boolean如果線條是連接器,則傳回 true;如果線條不是連接器,則傳回 false
preconcatenateTransform(transform)Line將提供的轉換預先串連成頁面元素的現有轉換。
remove()void移除網頁元素。
removeLink()void移除 Link
reroute()Line將路線的起點和終點重新轉送至連結頁面元素上最接近的兩個連線網站。
scaleHeight(ratio)Line根據指定的比例縮放元素的高度。
scaleWidth(ratio)Line根據指定的比例縮放元素的寬度。
select()void僅選取使用中的簡報中的 PageElement,並移除先前的所有選取項目。
select(replace)void選取目前簡報中的PageElement
sendBackward()Line讓頁面元素回到頁面中的一個元素。
sendToBack()Line將網頁元素傳送至網頁背面。
setDashStyle(style)Line設定線條的 DashStyle
setDescription(description)Line設定頁面元素的替代文字說明。
setEnd(left, top)Line設定線條終點的位置。
setEnd(point)Line設定線條終點的位置。
setEndArrow(style)Line設定線條終點的箭頭 ArrowStyle
setEndConnection(connectionSite)Line設定行尾的連線。
setHeight(height)Line設定元素的高度 (以點為單位),也就是元素未旋轉時,元素的定界框高度。
setLeft(left)Line設定元素的水平位置 (以點為單位)。當元素沒有旋轉時,從頁面左上角測量。
setLineCategory(lineCategory)Line設定線條的 LineCategory
setLinkSlide(slideIndex)Link使用投影片的索引 (從零開始計算),將 Link 設為指定的 Slide
setLinkSlide(slide)LinkLink 設為指定的 Slide,連結由指定的投影片 ID 設定。
setLinkSlide(slidePosition)Link使用投影片的相對位置,將 Link 設為指定的 Slide
setLinkUrl(url)LinkLink 設為指定的非空白網址字串。
setRotation(angle)Line設定元素的順時針旋轉角度,以度為單位。
setStart(left, top)Line設定線條的起點位置。
setStart(point)Line設定線條的起點位置。
setStartArrow(style)Line設定線條開頭的箭頭 ArrowStyle
setStartConnection(connectionSite)Line設定行開頭的連線。
setTitle(title)Line設定頁面元素的替代文字標題。
setTop(top)Line設定元素的垂直位置 (在元素未旋轉時從頁面左上角測量)。
setTransform(transform)Line使用提供的轉換設定頁面元素的轉換。
setWeight(points)Line設定點中的線條粗細。
setWidth(width)Line設定元素的寬度 (以點表示,在元素未旋轉時,元素的定界框寬度)。

內容詳盡的說明文件

alignOnPage(alignmentPosition)

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

參數

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

回攻員

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


bringForward()

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

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

回攻員

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

授權

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

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

bringToFront()

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

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

回攻員

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

授權

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

  • 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

getConnectionSites()

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

回攻員

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

授權

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

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

getDashStyle()

取得線條的 DashStyle

回攻員

DashStyle - 這條路線中虛線的樣式。

授權

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

  • 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

getEnd()

傳回線條的終點 (從頁面左上角開始計算)。

回攻員

Point - 線條的終點。

授權

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

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

getEndArrow()

取得線條終點的 ArrowStyle 箭頭。

回攻員

ArrowStyle:這條路線末端的箭頭樣式。

授權

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

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

getEndConnection()

在線條末端傳回連線;如果沒有連線,則傳回 null

回攻員

ConnectionSite:線條結束時的連線。

授權

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

  • 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

getLineCategory()

取得線條的 LineCategory

回攻員

LineCategory - 線條類別。

授權

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

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

getLineFill()

取得線條的 LineFill

回攻員

LineFill:這一行的填入設定。

授權

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

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

getLineType()

取得線條的 LineType

回攻員

LineType - 這條路線的類型。

授權

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

  • 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

getRotation()

傳回元素中心以度為單位的順時針旋轉角度,零度表示不會旋轉。

回攻員

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

授權

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

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

getStart()

傳回線條的起點 (從頁面左上角開始計算)。

回攻員

Point:線條的起點。

授權

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

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

getStartArrow()

取得行開頭的箭頭 ArrowStyle

回攻員

ArrowStyle:這條路線開頭的箭頭樣式。

授權

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

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

getStartConnection()

傳回行開頭的連線;如果沒有連線,則傳回 null

回攻員

ConnectionSite:線條開頭的連線。

授權

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

  • 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

getWeight()

傳回點中線條的粗細。

回攻員

Number:線條中的線條粗細。

授權

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

  • 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

isConnector()

如果線條是連接器,則傳回 true;如果沒有,則傳回 false

連接器是一種線條,用於在適用網頁元素上連接連線網站。連接器的每端最多只能連線至一個連線網站。

回攻員

Boolean:如果線條是連接器,則為 True;如果不是連接器,則為 false

授權

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

  • 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轉換至此頁面元素轉換的轉換。

回攻員

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

授權

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

  • 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();

reroute()

將路線的起點和終點重新轉送至連結頁面元素上最接近的兩個連線網站。行的開頭和結尾必須連接至不同的頁面元素。

回攻員

Line:線條。

授權

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

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

scaleHeight(ratio)

根據指定的比例縮放元素的高度。當元素未旋轉時,元素的高度是指其定界框的高度。

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

參數

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

回攻員

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

授權

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

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

scaleWidth(ratio)

根據指定的比例縮放元素的寬度。當元素未旋轉時,元素的寬度即為定界框的寬度。

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

參數

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

回攻員

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

授權

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

  • 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.selectAsCurrentPage() 選取父項 Page,然後再選取該網頁中的頁面元素。

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()

讓網頁元素回到網頁上一個元素。

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

回攻員

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

授權

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

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

sendToBack()

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

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

回攻員

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

授權

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

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

setDashStyle(style)

設定線條的 DashStyle

參數

名稱類型說明
styleDashStyle為這條線條設定的虛線樣式。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

  • 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用來設定替代文字說明的字串。

回攻員

Line:這個網頁元素。

授權

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

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

setEnd(left, top)

設定線條終點的位置。

線條路徑可以在位置變更後調整。

參數

名稱類型說明
leftNumber線條終點的水平位置 (以頁面左上角的點為準)。
topNumber線條終點的垂直位置 (從頁面左上角的點開始計算)。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setEnd(point)

設定線條終點的位置。

線條路徑可以在位置變更後調整。

參數

名稱類型說明
pointPoint線條的終點,其位置是從頁面左上角開始計算。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setEndArrow(style)

設定線條終點的箭頭 ArrowStyle

參數

名稱類型說明
styleArrowStyle要設定的樣式。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setEndConnection(connectionSite)

設定行尾的連線。這會將線條的結尾移至指定的連線網站,同時保留另一端。

參數

名稱類型說明
connectionSiteConnectionSite更新結束連線的目標連線網站;如果移除結束連線,則為 null

回攻員

Line:線條。

授權

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

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

setHeight(height)

設定元素的高度 (以點為單位),也就是元素未旋轉時,元素的定界框高度。

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

參數

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

回攻員

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

授權

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

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

setLeft(left)

設定元素的水平位置 (以點為單位)。當元素沒有旋轉時,從頁面左上角測量。

參數

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

回攻員

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

授權

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

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

setLineCategory(lineCategory)

設定線條的 LineCategory

您只能在 connectors 設定類別。連接器可能會在變更類別後重新轉送。

參數

名稱類型說明
lineCategoryLineCategory要設定的線條類別。

回攻員

Line:線條。

授權

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

  • 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要設定的新順時針旋轉角度,以度為單位。

回攻員

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

授權

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

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

setStart(left, top)

設定線條的起點位置。

線條路徑可以在位置變更後調整。

參數

名稱類型說明
leftNumber線條起點的水平位置,從頁面左上角的點開始。
topNumber線條起點的垂直位置 (從頁面左上角的點開始計算)。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setStart(point)

設定線條的起點位置。

線條路徑可以在位置變更後調整。

參數

名稱類型說明
pointPoint線條的起點,其位置從頁面左上角開始。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setStartArrow(style)

設定線條開頭的箭頭 ArrowStyle

參數

名稱類型說明
styleArrowStyle要設定的新箭頭樣式。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setStartConnection(connectionSite)

設定行開頭的連線。這會將線條的開頭移至指定的連線網站,同時保留另一端。

參數

名稱類型說明
connectionSiteConnectionSite起始連線更新的目標連線網站;如果移除起始連線,請設為 null

回攻員

Line:線條。

授權

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

  • 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要設定替代文字標題的字串。

回攻員

Line:這個網頁元素。

授權

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

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

setTop(top)

設定元素的垂直位置 (在元素未旋轉時從頁面左上角測量)。

參數

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

回攻員

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

授權

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

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

setTransform(transform)

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

更新群組的轉換會變更群組中網頁元素的絕對轉換,進而變更外觀外觀。

如果更新群組中的網頁元素,則只會變更該頁面元素的轉換,不會影響群組或群組中的其他頁面元素轉換。

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

參數

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

回攻員

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

授權

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

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

setWeight(points)

設定點中的線條粗細。

參數

名稱類型說明
pointsNumber線條的新粗細。

回攻員

Line:此為鏈結,用於鏈結。

授權

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

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

setWidth(width)

設定元素的寬度 (以點表示,在元素未旋轉時,元素的定界框寬度)。

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

參數

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

回攻員

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

授權

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

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