代表篩選器,用於以非協作方式篩選範圍、圖表和資料透視表。這個類別包含用於存取及修改現有切片器的方法。如要建立新的切片器,請使用 Sheet.insertSlicer(range, anchorRowPos, anchorColPos)。
方法
| 方法 | 傳回類型 | 簡短說明 | 
|---|---|---|
| get | Color | 傳回切割器的背景 Color。 | 
| get | Integer | 傳回在切片器中套用篩選器的資料欄位置 (相對於切片器的資料範圍),如果未設定資料欄位置,則傳回 null。 | 
| get | Container | 取得切片器在工作表中的位置資訊。 | 
| get | Filter | 傳回切片器的篩選條件,如果未設定篩選條件,則傳回 null。 | 
| get | Range | 取得切片器套用的資料範圍。 | 
| get | String | 傳回切割器的標題。 | 
| get | String | 取得標題的水平對齊方式。 | 
| get | Text | 傳回切片器標題的文字樣式。 | 
| is | Boolean | 傳回指定切片器是否套用至資料透視表。 | 
| remove() | void | 刪除篩選器。 | 
| set | Slicer | 設定是否要將指定的篩選器套用至工作表中的資料透視表。 | 
| set | Slicer | 設定切片器的背景顏色。 | 
| set | Slicer | 設定切割器的背景 Color。 | 
| set | Slicer | 設定切片器的資料欄索引和篩選條件。 | 
| set | Slicer | 設定切片器在工作表上顯示的位置。 | 
| set | Slicer | 設定要套用切片器的資料範圍。 | 
| set | Slicer | 設定切片器的標題。 | 
| set | Slicer | 設定切片器中標題的水平對齊方式。 | 
| set | Slicer | 設定切片器的文字樣式。 | 
內容詳盡的說明文件
get
get
傳回在切片器中套用篩選器的資料欄位置 (相對於切片器的資料範圍),如果未設定資料欄位置,則傳回 null。這個值應為資料欄的 1 索引位置,類似篩選器。
回攻員
Integer:切片器的資料欄位置。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets
get
取得切片器在工作表中的位置資訊。
回攻員
Container:包含切片器容器位置的物件。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets
get
傳回切片器的篩選條件,如果未設定篩選條件,則傳回 null。
回攻員
Filter:這個切片器的篩選條件。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets
get
get
傳回切割器的標題。
回攻員
String:這個切割器可用於鏈結。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets
get
取得標題的水平對齊方式。
回攻員
String:切片器標題的水平對齊方式。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets
get
is
傳回指定切片器是否套用至資料透視表。
回攻員
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
set
set
set
set
設定切片器的資料欄索引和篩選條件。null 值會重設切片器篩選器。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| column | Integer | 這個切片器的新資料欄位置。 | 
| filter | Filter | 這個切片器的新篩選條件。 | 
回攻員
Slicer:這個切割器可用於鏈結。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets
set
設定切片器在工作表上顯示的位置。錨定資料列和資料欄位置的索引為 1。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| anchor | Integer | 切片器的頂端會固定在這個列中。 | 
| anchor | Integer | 切片器的頂端會固定在這個欄中。 | 
| offsetX | Integer | 以像素為單位的單元格角落水平偏移。 | 
| offsetY | Integer | 以像素為單位的單元格角落垂直偏移。 | 
回攻員
Slicer:這個切割器可用於鏈結。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/spreadsheets.currentonly
- 
https://www.googleapis.com/auth/spreadsheets