Excel.RangeSort class

管理对 Range 对象的排序操作。Manages sorting operations on Range objects.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

Extends

属性

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

方法

apply(fields, matchCase, hasHeaders, orientation, method)

执行排序操作。Perform a sort operation.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

apply(fields, matchCase, hasHeaders, orientationString, method)

执行排序操作。Perform a sort operation.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始 RangeSort 对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.RangeSortData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.RangeSort object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.RangeSortData), 其中包含原始对象中所有已加载的子属性的浅表副本。) that contains shallow copies of any loaded child properties from the original object.

属性详细信息

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

context: RequestContext;

属性值

RequestContext

方法详细信息

apply(fields, matchCase, hasHeaders, orientation, method)

执行排序操作。Perform a sort operation.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

apply(fields: Excel.SortField[], matchCase?: boolean, hasHeaders?: boolean, orientation?: Excel.SortOrientation, method?: Excel.SortMethod): void;

参数

fields
Excel.SortField[]

要用作排序依据的条件列表。The list of conditions to sort on.

matchCase
boolean

可选。Optional. 是否让大小写对字符串排序产生影响。Whether to have the casing impact string ordering.

hasHeaders
boolean

可选。Optional. 该区域是否有标头。Whether the range has a header.

orientation
Excel.SortOrientation

可选。Optional. 该操作是对行还是列排序。Whether the operation is sorting rows or columns.

method
Excel.SortMethod

可选。Optional. 用于中文字符的排序方法。The ordering method used for Chinese characters.

返回

void

apply(fields, matchCase, hasHeaders, orientationString, method)

执行排序操作。Perform a sort operation.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

apply(fields: Excel.SortField[], matchCase?: boolean, hasHeaders?: boolean, orientationString?: "Rows" | "Columns", method?: "PinYin" | "StrokeCount"): void;

参数

fields
Excel.SortField[]

要用作排序依据的条件列表。The list of conditions to sort on.

matchCase
boolean

可选。Optional. 是否让大小写对字符串排序产生影响。Whether to have the casing impact string ordering.

hasHeaders
boolean

可选。Optional. 该区域是否有标头。Whether the range has a header.

orientationString
"Rows" | "Columns"

可选。Optional. 该操作是对行还是列排序。Whether the operation is sorting rows or columns.

method
"PinYin" | "StrokeCount"

可选。Optional. 用于中文字符的排序方法。The ordering method used for Chinese characters.

返回

void

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始 RangeSort 对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.RangeSortData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.RangeSort object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.RangeSortData), 其中包含原始对象中所有已加载的子属性的浅表副本。) that contains shallow copies of any loaded child properties from the original object.

toJSON(): {
            [key: string]: string;
        };

返回

{ [key: string]: string; }