Class OverGridImage

OverGridImage

代表試算表格線上的圖片。

方法

方法傳回類型簡短說明
assignScript(functionName)OverGridImage將具有指定函式名稱的函式指派給這個圖片。
getAltTextDescription()String傳回這張圖片的替代文字說明。
getAltTextTitle()String傳回這張圖片的替代文字標題。
getAnchorCell()Range傳回圖片錨定的儲存格。
getAnchorCellXOffset()Integer傳回錨定儲存格的水平像素偏移量。
getAnchorCellYOffset()Integer傳回錨定儲存格的垂直像素偏移量。
getHeight()Integer以像素為單位傳回這張圖片的實際高度。
getInherentHeight()Integer以像素為單位傳回這張圖片的固有高度。
getInherentWidth()Integer以像素為單位傳回這張圖片的固有高度。
getScript()String傳回指派給這張圖片的函式名稱。
getSheet()Sheet傳回顯示這張圖片的工作表。
getWidth()Integer傳回這張圖片的實際寬度 (以像素為單位)。
remove()void從試算表刪除這張圖片。
replace(blob)OverGridImage使用提供的 BlobSource 指定的圖片取代這張圖片。
replace(url)OverGridImage將這張圖片換成指定網址的圖片。
resetSize()OverGridImage將圖片重設為原始尺寸。
setAltTextDescription(description)OverGridImage設定這張圖片的替代文字說明。
setAltTextTitle(title)OverGridImage設定這張圖片的替代文字標題。
setAnchorCell(cell)OverGridImage設定圖片錨定的儲存格。
setAnchorCellXOffset(offset)OverGridImage設定與錨定儲存格的水平像素偏移量。
setAnchorCellYOffset(offset)OverGridImage設定與錨定儲存格的垂直像素偏移量。
setHeight(height)OverGridImage以像素為單位設定圖片的實際高度。
setWidth(width)OverGridImage以像素為單位設定圖片的實際寬度。

內容詳盡的說明文件

assignScript(functionName)

將具有指定函式名稱的函式指派給這個圖片。

參數

名稱類型說明
functionNameString指定的函式名稱。這必須是公開頂層函式,不得為以底線結尾的函式,例如 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()

傳回圖片錨定的儲存格。

回攻員

Range:錨點儲存格。

授權

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

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

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
const images = SpreadsheetApp.getActiveSpreadsheet().getImages();
for (let 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
const images = SpreadsheetApp.getActiveSpreadsheet().getImages();
for (let 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

getWidth()

以像素為單位傳回這張圖片的實際寬度。

// Logs the width of all images in a spreadsheet
const images = SpreadsheetApp.getActiveSpreadsheet().getImages();
for (let 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
const images = SpreadsheetApp.getActiveSpreadsheet().getImages();
for (let 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。

參數

名稱類型說明
blobBlobSource以 Blob 形式呈現的新圖片。

回攻員

OverGridImage - 這個圖片,用於鏈結。

授權

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

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

replace(url)

將這張圖片換成指定網址的圖片。

參數

名稱類型說明
urlString新圖片的網址。

回攻員

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)

設定這張圖片的替代文字說明。

參數

名稱類型說明
descriptionString圖片的新替代文字說明。

回攻員

OverGridImage - 這個圖片,用於鏈結。

授權

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

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

setAltTextTitle(title)

設定這張圖片的替代文字標題。

參數

名稱類型說明
titleString圖片的新替代文字標題。

回攻員

OverGridImage - 這個圖片,用於鏈結。

授權

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

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

setAnchorCell(cell)

設定圖片錨定的儲存格。

參數

名稱類型說明
cellRange新的錨定儲存格。

回攻員

OverGridImage - 這個圖片,用於鏈結。

授權

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

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

setAnchorCellXOffset(offset)

設定與錨定儲存格的水平像素偏移量。

參數

名稱類型說明
offsetInteger新的水平像素偏移。

回攻員

OverGridImage - 這個圖片,用於鏈結。

授權

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

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

setAnchorCellYOffset(offset)

設定與錨定儲存格的垂直像素偏移量。

參數

名稱類型說明
offsetInteger新的垂直像素偏移。

回攻員

OverGridImage - 這個圖片,用於鏈結。

授權

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

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

setHeight(height)

以像素為單位設定圖片的實際高度。

參數

名稱類型說明
heightInteger所需高度 (以像素為單位)。

回攻員

OverGridImage - 鏈結的圖片。

授權

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

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

setWidth(width)

以像素為單位設定圖片的實際寬度。

參數

名稱類型說明
widthInteger所需的寬度 (以像素為單位)。

回攻員

OverGridImage - 鏈結的圖片。

授權

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

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

已淘汰的方法