ExcelScript.SortBy enum
表示排序方向。
注解
使用方
示例
/**
* This script shows how to use setAutoSortOnCell to automatically sort
* a PivotTable's row labels based on values in a specific data column.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the "Farm Pivot" PivotTable.
const pivotTable = workbook.getPivotTable("Farm Pivot");
const sheet = pivotTable.getWorksheet();
// Get the PivotTable's layout object.
const layout = pivotTable.getLayout();
// Pick a cell in the PivotTable's data area to sort by.
const sortCell1 = sheet.getRange("N6");
layout.setAutoSortOnCell(sortCell1, ExcelScript.SortBy.descending);
}
字段
| ascending | 升序排序。 从小到大或 A 到 Z。 |
| descending | 降序排序。 从最大到最小或 Z 到 A。 |