此元素代表試算表中格狀檢視的圖片。
方法
內容詳盡的說明文件
assignScript(functionName)
將含有指定函式名稱的函式指派給這張圖片。
參數
名稱 | 類型 | 說明 |
---|---|---|
functionName | String | 指定的函式名稱。這必須是公開的頂層函式,而非結尾為底線的函式 (例如 privateFunction_ )。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getAltTextDescription()
傳回這張圖片的替代文字說明。
回攻員
String
:替代文字說明。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getAltTextTitle()
傳回這張圖片的替代文字標題。
回攻員
String
:替代文字標題。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getAnchorCell()
getAnchorCellXOffset()
傳回錨點儲存格的水平像素偏移。
回攻員
Integer
:水平像素偏移。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getAnchorCellYOffset()
傳回錨定儲存格中的垂直像素偏移。
回攻員
Integer
— 垂直像素偏移。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getHeight()
傳回這張圖片的實際高度 (以像素為單位)。
// Logs the height of all images in a spreadsheet var images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (var i = 0; i < images.length; i++) { Logger.log(images[i].getHeight()); }
回攻員
Integer
:圖片的高度,以像素為單位。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getInherentHeight()
傳回這張圖片的固有高度 (以像素為單位)。
回攻員
Integer
— 固有高度 (以像素為單位)。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getInherentWidth()
傳回這張圖片的固有高度 (以像素為單位)。
回攻員
Integer
— 固有寬度 (以像素為單位)。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getScript()
傳回指派給此圖片的函式名稱。
回攻員
String
:函式的名稱。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSheet()
傳回這個圖片所在的工作表。
// Logs the parent sheet of all images in a spreadsheet var images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (var i = 0; i < images.length; i++) { Logger.log(images[i].getSheet()); }
回攻員
Sheet
:顯示圖片的工作表。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getUrl()
取得圖片的來源網址;如果網址無法使用,則傳回 null
。如果使用 API 透過網址插入圖片,這個方法會傳回圖片插入期間提供的網址。
回攻員
String
:圖片網址 (如果有的話);如果圖片無法使用或沒有來源網址,則傳回 null
。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getWidth()
傳回這張圖片的實際寬度 (以像素為單位)。
// Logs the width of all images in a spreadsheet var images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (var i = 0; i < images.length; i++) { Logger.log(images[i].getWidth()); }
回攻員
Integer
:圖片的寬度,以像素為單位。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
remove()
從試算表中刪除這張圖片。對圖片進行任何其他操作都會導致指令碼錯誤。
// Deletes all images in a spreadsheet var images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (var i = 0; i < images.length; i++) { images[i].remove(); }
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
replace(blob)
將這張圖片替換成提供的 BlobSource
指定的圖片。支援的 blob 大小上限為 2 MB。
參數
名稱 | 類型 | 說明 |
---|---|---|
blob | BlobSource | 新圖片做為 Blob。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
replace(url)
將這張圖片替換成指定網址的圖片。
參數
名稱 | 類型 | 說明 |
---|---|---|
url | String | 新圖片的網址。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
resetSize()
將這張圖片重設為原理尺寸。
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setAltTextDescription(description)
設定這張圖片的替代文字說明。
參數
名稱 | 類型 | 說明 |
---|---|---|
description | String | 圖片的新替代文字說明。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setAltTextTitle(title)
設定這張圖片的替代文字標題。
參數
名稱 | 類型 | 說明 |
---|---|---|
title | String | 圖片的新替代文字標題。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setAnchorCell(cell)
設定錨定圖片的儲存格。
參數
名稱 | 類型 | 說明 |
---|---|---|
cell | Range | 新的錨定儲存格。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setAnchorCellXOffset(offset)
設定與錨定儲存格之間的水平像素偏移。
參數
名稱 | 類型 | 說明 |
---|---|---|
offset | Integer | 新的水平像素偏移。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setAnchorCellYOffset(offset)
設定與錨定儲存格間的垂直像素位移。
參數
名稱 | 類型 | 說明 |
---|---|---|
offset | Integer | 新的垂直像素偏移。 |
回攻員
OverGridImage
— 此圖片,用於鏈結。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setHeight(height)
設定這張圖片的實際高度 (以像素為單位)。
參數
名稱 | 類型 | 說明 |
---|---|---|
height | Integer | 所需的高度 (以像素為單位)。 |
回攻員
OverGridImage
— 鏈結圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setWidth(width)
設定這張圖片的實際寬度 (以像素為單位)。
參數
名稱 | 類型 | 說明 |
---|---|---|
width | Integer | 所需的寬度 (以像素為單位), |
回攻員
OverGridImage
— 鏈結圖片。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets