顯示影片的版面配置項目。您可以透過 Form
存取或建立項目。
// Open a form by ID and add three new video items, using a long URL, // a short URL, and a video ID. var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); form.addVideoItem() .setTitle('Video Title') .setHelpText('Video Caption') .setVideoUrl('www.youtube.com/watch?v=1234abcdxyz'); form.addVideoItem() .setTitle('Video Title') .setHelpText('Video Caption') .setVideoUrl('youtu.be/1234abcdxyz'); form.addVideoItem() .setTitle('Video Title') .setHelpText('Video Caption') .setVideoUrl('1234abcdxyz');
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
duplicate() | VideoItem | 建立這個項目的副本,然後附加到表單結尾。 |
getAlignment() | Alignment | 取得影片的水平對齊。 |
getHelpText() | String | 取得商品的說明文字 (有時為版面配置項目的說明文字,例如 ImageItems 、PageBreakItems 和 SectionHeaderItems )。 |
getId() | Integer | 取得商品的專屬 ID。 |
getIndex() | Integer | 取得表單中所有商品的索引。 |
getTitle() | String | 取得商品標題 (有時為 SectionHeaderItem 標頭)。 |
getType() | ItemType | 取得項目類型,以 ItemType 表示。 |
getWidth() | Integer | 取得影片的寬度 (以像素為單位)。 |
setAlignment(alignment) | VideoItem | 設定影片的水平對齊方式。 |
setHelpText(text) | VideoItem | 設定項目的說明文字 (有時是指 ImageItems 、PageBreakItems 和 SectionHeaderItems 等版面配置項目的說明文字)。 |
setTitle(title) | VideoItem | 設定項目標題 (有時在 SectionHeaderItem 中稱為標題文字)。 |
setVideoUrl(youtubeUrl) | VideoItem | 設定指定 YouTube 網址或 YouTube 影片 ID 的影片。 |
setWidth(width) | VideoItem | 設定影片的寬度 (以像素為單位)。 |
內容詳盡的說明文件
duplicate()
getAlignment()
getHelpText()
取得商品的說明文字 (有時為版面配置項目的說明文字,例如 ImageItems
、PageBreakItems
和 SectionHeaderItems
)。
Return 鍵
String
:項目的說明文字或說明文字
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getId()
取得商品的專屬 ID。
Return 鍵
Integer
:該項目的 ID
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getIndex()
取得表單中所有商品的索引。
Return 鍵
Integer
:項目的索引
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getTitle()
取得商品標題 (有時為 SectionHeaderItem
標頭)。
Return 鍵
String
:項目的標題或標題文字
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
getType()
getWidth()
取得影片的寬度 (以像素為單位)。
Return 鍵
Integer
:以像素為單位的寬度
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setAlignment(alignment)
setHelpText(text)
設定項目的說明文字 (有時是指 ImageItems
、PageBreakItems
和 SectionHeaderItems
等版面配置項目的說明文字)。
參數
名稱 | 類型 | 說明 |
---|---|---|
text | String | 新的說明文字 |
Return 鍵
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms
setTitle(title)
設定項目標題 (有時在 SectionHeaderItem
中稱為標題文字)。
參數
名稱 | 類型 | 說明 |
---|---|---|
title | String | 新的標題或標題文字 |
Return 鍵
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly
-
https://www.googleapis.com/auth/forms