ExcelScript.SortOn enum
表示用作排序条件的单元格部分。
注解
示例
/**
* This script sorts a range based on the color of the cells.
* It brings all red cells to the top of the range.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the range (A1:D8) to sort from the current worksheet.
const worksheet = workbook.getActiveWorksheet();
const rangeToSort = worksheet.getRange("A1:D8");
// Create a SortField for color sorting.
// This sorts the rows based on the fill color of each row's cell in the first column.
let colorSort: ExcelScript.SortField = {
ascending: true,
color: "FF0000", /* red */
key: 0,
sortOn: ExcelScript.SortOn.cellColor
};
// Apply the SortField to the range.
rangeToSort.getSort().apply([colorSort]);
}
字段
cellColor | |
fontColor | |
icon | |
value |
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈