Class SortSpec
详细文档
getBackgroundColor()
返回用于排序的背景颜色,如果不存在,则返回 null
。
返回
Color
- 背景颜色。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceColumn()
获取排序规范作用的数据源列。如果此排序规范不针对数据源列进行操作,则返回 null
。
返回
DataSourceColumn
- 排序规范作用的数据源列。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDimensionIndex()
返回维度索引,如果未关联到本地过滤器,则返回 null
。
返回
Integer
- 维度索引。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getForegroundColor()
返回用于排序的前景颜色,如果不存在,则返回 null
。
返回
Color
- 前景色。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSortOrder()
返回排序顺序。
返回
SortOrder
- 排序顺序。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
isAscending()
返回排序顺序是升序还是降序。
返回
Boolean
- 如果排序顺序为升序,则为 true
;否则为 false
。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-02。
[null,null,["最后更新时间 (UTC):2024-12-02。"],[[["`SortSpec` defines the specifications for sorting data, such as sort order, colors, and the data source."],["It provides methods to retrieve information about the sort specification, including background and foreground colors, sort order, and the data source column being used."],["You can determine if the sort order is ascending using the `isAscending()` method and obtain the dimension index with `getDimensionIndex()`."],["All methods within `SortSpec` require authorization with specific scopes related to spreadsheet access."]]],["SortSpec defines the criteria for sorting data. Key actions include retrieving the background and foreground colors used in sorting, if any. It fetches the data source column being sorted, or returns null if not present. It can retrieve the dimension index if linked to a filter. The sort order itself, along with whether the sorting is ascending, can also be obtained using the methods `getSortOrder()` and `isAscending()` respectively.\n"]]