代表授權器,用於以非協同合作的方式篩選範圍、圖表和資料透視表。這個類別包含存取及修改現有的篩選器控制項的方法。如要建立新的篩選器控制項,請使用 Sheet.insertSlicer(range, anchorRowPos, anchorColPos)
。
方法
內容詳盡的說明文件
getBackgroundColorObject()
getColumnPosition()
傳回在篩選器控制項中套用篩選器的欄位置 (相對於篩選器控制項的資料範圍),如未傳回資料欄位置,則傳回「null
」。這應該會是資料欄的 1 索引位置,與篩選器類似。
Return 鍵
Integer
:這個篩選器控制項的欄位置,
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getContainerInfo()
取得篩選器控制項在工作表中的位置。
Return 鍵
ContainerInfo
— 包含 Slice' 容器位置的物件。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getFilterCriteria()
傳回篩選器控制項的篩選條件,如未設定篩選條件,則傳回 null
。
Return 鍵
FilterCriteria
:這個篩選器控制項的篩選條件。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRange()
getTitle()
傳回篩選器控制項的標題。
Return 鍵
String
— 此區塊控制項,用於鏈結。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getTitleHorizontalAlignment()
取得標題的水平對齊方式。
Return 鍵
String
:這個篩選器控制項標題的水平對齊。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getTitleTextStyle()
isAppliedToPivotTables()
傳回是否套用資料透視表的指定篩選器控制項。
Return 鍵
Boolean
— 如果在這個資料透視表套用至資料透視表,則設為 true
,否則為 false
。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
remove()
刪除篩選器控制項。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setApplyToPivotTables(applyToPivotTables)
setBackgroundColor(color)
setBackgroundColorObject(color)
setColumnFilterCriteria(columnPosition, filterCriteria)
設定篩選器控制項的資料欄索引和篩選條件。null
值會重設篩選器篩選器。
參數
名稱 | 類型 | 說明 |
---|---|---|
columnPosition | Integer | 這個篩選器控制項的新欄位置。 |
filterCriteria | FilterCriteria | 這個篩選器控制項的新篩選條件。 |
Return 鍵
Slicer
— 此區塊控制項,用於鏈結。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)
設定篩選器控制項在工作表上的位置。錨點列和欄位置索引是 1 的索引。
參數
名稱 | 類型 | 說明 |
---|---|---|
anchorRowPos | Integer | 篩選器控制項的上方會固定在此列中。 |
anchorColPos | Integer | 篩選器工具的上方有錨點。 |
offsetX | Integer | 儲存格角落的水平偏移量 (以像素為單位)。 |
offsetY | Integer | 儲存格角落的垂直偏移量 (以像素為單位)。 |
Return 鍵
Slicer
— 此區塊控制項,用於鏈結。
授權
如果指令碼使用這個方法,就必須符合下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets