Excel.WorksheetCollection class

表示属于工作簿的 worksheet 对象的集合。Represents a collection of worksheet objects that are part of the workbook.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

Extends

属性

context

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

items

获取此集合中已加载的子项。Gets the loaded child items in this collection.

方法

add(name)

向工作簿添加新工作表。工作表将添加到现有工作表的末尾。如果您想要激活新添加的工作表,请对其调用 ".activate()。Adds a new worksheet to the workbook. The worksheet will be added at the end of existing worksheets. If you wish to activate the newly added worksheet, call ".activate() on it.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

addFromBase64(base64File, sheetNamesToInsert, positionType, relativeTo)

将工作簿的指定工作表插入当前工作簿。Inserts the specified worksheets of a workbook into the current workbook.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

addFromBase64(base64File, sheetNamesToInsert, positionTypeString, relativeTo)

将工作簿的指定工作表插入当前工作簿。Inserts the specified worksheets of a workbook into the current workbook.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

getActiveWorksheet()

获取工作簿中当前处于活动状态的工作表。Gets the currently active worksheet in the workbook.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

getCount(visibleOnly)

获取集合中的工作表数量。Gets the number of worksheets in the collection.

[API 集: ExcelApi 1.4][ API set: ExcelApi 1.4 ]

getFirst(visibleOnly)

获取集合中的第一个工作表。Gets the first worksheet in the collection.

[API 集: ExcelApi 1.5][ API set: ExcelApi 1.5 ]

getItem(key)

按 Worksheet 对象的名称或 ID 获取此对象。Gets a worksheet object using its Name or ID.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

getItemOrNullObject(key)

按 Worksheet 对象的名称或 ID 获取此对象。Gets a worksheet object using its Name or ID. 如果没有 Worksheet 对象,将返回 NULL 对象。If the worksheet does not exist, will return a null object.

[API 集: ExcelApi 1.4][ API set: ExcelApi 1.4 ]

getLast(visibleOnly)

获取集合中的最后一个工作表。Gets the last worksheet in the collection.

[API 集: ExcelApi 1.5][ API set: ExcelApi 1.5 ]

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(option)
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给它的对象的方法。尽管原始Excel.WorksheetCollection对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.WorksheetCollectionData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.WorksheetCollection object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.WorksheetCollectionData), 其中包含集合的项中所有加载属性的浅表副本的 "items" 数组。) that contains an "items" array with shallow copies of any loaded properties from the collection's items.

事件

onActivated

当工作簿中的任何工作表激活时发生此事件。Occurs when any worksheet in the workbook is activated.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

onAdded

将新工作表添加到工作簿时发生此事件。Occurs when a new worksheet is added to the workbook.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

onCalculated

计算工作簿中的任何工作表时发生。Occurs when any worksheet in the workbook is calculated.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

onChanged

在更改工作簿中的任何工作表时发生。Occurs when any worksheet in the workbook is changed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

onColumnSorted

对列进行排序时发生。Occurs when sorting on columns.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

onDeactivated

当工作簿中的任何工作表被停用时发生。Occurs when any worksheet in the workbook is deactivated.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

onDeleted

当从工作簿中删除工作表时发生此事件。Occurs when a worksheet is deleted from the workbook.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

onFiltered

在工作簿中应用任何工作表的筛选器时发生。Occurs when any worksheet's filter is applied in the workbook.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

onFormatChanged

在更改工作簿中的任何工作表的格式时发生。Occurs when any worksheet in the workbook has format changed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

onRowSorted

对行进行排序时发生。Occurs when sorting on rows.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

onSelectionChanged

在任何工作表上更改选择时发生。Occurs when the selection changes on any worksheet.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

属性详细信息

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

items

获取此集合中已加载的子项。Gets the loaded child items in this collection.

readonly items: Excel.Worksheet[];

属性值

Excel.Worksheet[]

方法详细信息

add(name)

向工作簿添加新工作表。工作表将添加到现有工作表的末尾。如果您想要激活新添加的工作表,请对其调用 ".activate()。Adds a new worksheet to the workbook. The worksheet will be added at the end of existing worksheets. If you wish to activate the newly added worksheet, call ".activate() on it.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

add(name?: string): Excel.Worksheet;

参数

name
string

可选。要添加的工作表的名称。如果指定,名称应唯一。如果未指定,Excel 将确定新工作表的名称。Optional. The name of the worksheet to be added. If specified, name should be unqiue. If not specified, Excel determines the name of the new worksheet.

返回

示例Examples

Excel.run(function (ctx) { 
    var wSheetName = 'Sample Name';
    var worksheet = ctx.workbook.worksheets.add(wSheetName);
    worksheet.load('name');
    return ctx.sync().then(function() {
        console.log(worksheet.name);
    });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

addFromBase64(base64File, sheetNamesToInsert, positionType, relativeTo)

备注

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

将工作簿的指定工作表插入当前工作簿。Inserts the specified worksheets of a workbook into the current workbook.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

addFromBase64(base64File: string, sheetNamesToInsert?: string[], positionType?: Excel.WorksheetPositionType, relativeTo?: Worksheet | string): OfficeExtension.ClientResult<string[]>;

参数

base64File
string

必需。Required. 代表源工作簿文件的 base64 编码的字符串。The base64-encoded string representing the source workbook file.

sheetNamesToInsert
string[]

可选。Optional. 要插入的单个工作表的名称。The names of individual worksheets to insert. 默认情况下, 会插入源工作簿中的所有工作表。By default, all the worksheets from the source workbook are inserted.

positionType
Excel.WorksheetPositionType

可选。Optional. 将在当前工作簿中插入新工作表的位置。Where in the current workbook the new worksheets will be inserted. 有关详细信息, 请参阅 WorksheetPositionType。See Excel.WorksheetPositionType for details. 默认值为 "Start"。Default is "Start".

relativeTo
Worksheet | string

可选。Optional. 为 positionType 参数引用的当前工作簿中的工作表。The worksheet in the current workbook that is referenced for the positionType parameter. 默认值为 null, 并且基于 positionType, 它将在当前工作簿的开始或末尾插入工作表。Default is null and, based on positionType, it will insert worksheets at the start or end of the current workbook.

返回

OfficeExtension.ClientResult<string[]>

与每个新插入的工作表对应的 id 的数组。An array of ids corresponding to each newly inserted worksheet.

示例Examples

const myFile = <HTMLInputElement>document.getElementById("file");
const reader = new FileReader();

reader.onload = (event) => {
    Excel.run((context) => {
        // strip off the metadata before the base64-encoded string
        const startIndex = (<string>(<FileReader>event.target).result).indexOf("base64,");
        const workbookContents = (<string>(<FileReader>event.target).result).substr(startIndex + 7);

        const sheets = context.workbook.worksheets;
        sheets.addFromBase64(
            workbookContents,
            null, // get all the worksheets 
            Excel.WorksheetPositionType.end // insert them after the current workbook's worksheets
            );
        return context.sync();
    });
};

// read in the file as a data URL so we can parse the base64-encoded string
reader.readAsDataURL(myFile.files[0]);

addFromBase64(base64File, sheetNamesToInsert, positionTypeString, relativeTo)

备注

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

将工作簿的指定工作表插入当前工作簿。Inserts the specified worksheets of a workbook into the current workbook.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

addFromBase64(base64File: string, sheetNamesToInsert?: string[], positionTypeString?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Worksheet | string): OfficeExtension.ClientResult<string[]>;

参数

base64File
string

必需。Required. 代表源工作簿文件的 base64 编码的字符串。The base64-encoded string representing the source workbook file.

sheetNamesToInsert
string[]

可选。Optional. 要插入的单个工作表的名称。The names of individual worksheets to insert. 默认情况下, 会插入源工作簿中的所有工作表。By default, all the worksheets from the source workbook are inserted.

positionTypeString
"None" | "Before" | "After" | "Beginning" | "End"

可选。Optional. 将在当前工作簿中插入新工作表的位置。Where in the current workbook the new worksheets will be inserted. 有关详细信息, 请参阅 WorksheetPositionType。See Excel.WorksheetPositionType for details. 默认值为 "Start"。Default is "Start".

relativeTo
Worksheet | string

可选。Optional. 为 positionType 参数引用的当前工作簿中的工作表。The worksheet in the current workbook that is referenced for the positionType parameter. 默认值为 null, 并且基于 positionType, 它将在当前工作簿的开始或末尾插入工作表。Default is null and, based on positionType, it will insert worksheets at the start or end of the current workbook.

返回

OfficeExtension.ClientResult<string[]>

与每个新插入的工作表对应的 id 的数组。An array of ids corresponding to each newly inserted worksheet.

getActiveWorksheet()

获取工作簿中当前处于活动状态的工作表。Gets the currently active worksheet in the workbook.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

getActiveWorksheet(): Excel.Worksheet;

返回

示例Examples

Excel.run(function (ctx) {  
    var activeWorksheet = ctx.workbook.worksheets.getActiveWorksheet();
    activeWorksheet.load('name');
    return ctx.sync().then(function() {
            console.log(activeWorksheet.name);
    });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

getCount(visibleOnly)

获取集合中的工作表数量。Gets the number of worksheets in the collection.

[API 集: ExcelApi 1.4][ API set: ExcelApi 1.4 ]

getCount(visibleOnly?: boolean): OfficeExtension.ClientResult<number>;

参数

visibleOnly
boolean

可选。Optional. 如果为 true, 则只考虑可见的工作表, 跳过任何隐藏的工作表。If true, considers only visible worksheets, skipping over any hidden ones.

返回

OfficeExtension.ClientResult<number>

getFirst(visibleOnly)

获取集合中的第一个工作表。Gets the first worksheet in the collection.

[API 集: ExcelApi 1.5][ API set: ExcelApi 1.5 ]

getFirst(visibleOnly?: boolean): Excel.Worksheet;

参数

visibleOnly
boolean

可选。Optional. 如果为 true, 则只考虑可见的工作表, 跳过任何隐藏的工作表。If true, considers only visible worksheets, skipping over any hidden ones.

返回

示例Examples

await Excel.run(async (context) => {
    const sheets = context.workbook.worksheets;

    // We don't want to include the default worksheet that was created
    // when the workbook was created, so our "firstSheet" will be the one
    // after the literal first. Note chaining of navigation methods.
    const firstSheet = sheets.getFirst().getNext();
    const lastSheet = sheets.getLast();
    const firstTaxRateRange = firstSheet.getRange("B2");
    const lastTaxRateRange = lastSheet.getRange("B2");

    firstSheet.load("name");
    lastSheet.load("name");
    firstTaxRateRange.load("text");
    lastTaxRateRange.load("text");

    await context.sync();

    let firstYear = firstSheet.name.substr(5, 4);
    let lastYear = lastSheet.name.substr(5, 4);
    console.log(`Tax Rate change from ${firstYear} to ${lastYear}`, `Tax rate for ${firstYear}: ${firstTaxRateRange.text[0][0]}\nTax rate for ${lastYear}: ${lastTaxRateRange.text[0][0]}`)

    await context.sync();
});

getItem(key)

按 Worksheet 对象的名称或 ID 获取此对象。Gets a worksheet object using its Name or ID.

[API 集: ExcelApi 1.1][ API set: ExcelApi 1.1 ]

getItem(key: string): Excel.Worksheet;

参数

key
string

工作表的名称或 ID。The Name or ID of the worksheet.

返回

getItemOrNullObject(key)

按 Worksheet 对象的名称或 ID 获取此对象。Gets a worksheet object using its Name or ID. 如果没有 Worksheet 对象,将返回 NULL 对象。If the worksheet does not exist, will return a null object.

[API 集: ExcelApi 1.4][ API set: ExcelApi 1.4 ]

getItemOrNullObject(key: string): Excel.Worksheet;

参数

key
string

工作表的名称或 ID。The Name or ID of the worksheet.

返回

getLast(visibleOnly)

获取集合中的最后一个工作表。Gets the last worksheet in the collection.

[API 集: ExcelApi 1.5][ API set: ExcelApi 1.5 ]

getLast(visibleOnly?: boolean): Excel.Worksheet;

参数

visibleOnly
boolean

可选。Optional. 如果为 true, 则只考虑可见的工作表, 跳过任何隐藏的工作表。If true, considers only visible worksheets, skipping over any hidden ones.

返回

示例Examples

await Excel.run(async (context) => {
    const sheets = context.workbook.worksheets;

    // We don't want to include the default worksheet that was created
    // when the workbook was created, so our "firstSheet" will be the one
    // after the literal first. Note chaining of navigation methods.
    const firstSheet = sheets.getFirst().getNext();
    const lastSheet = sheets.getLast();
    const firstTaxRateRange = firstSheet.getRange("B2");
    const lastTaxRateRange = lastSheet.getRange("B2");

    firstSheet.load("name");
    lastSheet.load("name");
    firstTaxRateRange.load("text");
    lastTaxRateRange.load("text");

    await context.sync();

    let firstYear = firstSheet.name.substr(5, 4);
    let lastYear = lastSheet.name.substr(5, 4);
    console.log(`Tax Rate change from ${firstYear} to ${lastYear}`, `Tax rate for ${firstYear}: ${firstTaxRateRange.text[0][0]}\nTax rate for ${lastYear}: ${lastTaxRateRange.text[0][0]}`)

    await context.sync();
});

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(option?: Excel.Interfaces.WorksheetCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.WorksheetCollection;

参数

option
Excel.Interfaces.WorksheetCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions

返回

注解

除了此签名之外, 此方法还具有以下签名:In addition to this signature, this method has the following signatures:

load(option?: string | string[]): Excel.WorksheetCollection-Where 选项是一个逗号分隔的字符串或一个字符串数组, 用于指定要加载的属性。load(option?: string | string[]): Excel.WorksheetCollection - Where option is a comma-delimited string or an array of strings that specify the properties to load.

load(option?: { select?: string; expand?: string; }): Excel.WorksheetCollection-Where 选项。选择是一个用逗号分隔的字符串, 用于指定要加载的属性和选项。 expand 是一个用逗号分隔的字符串, 用于指定要加载的导航属性。load(option?: { select?: string; expand?: string; }): Excel.WorksheetCollection - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.WorksheetCollection-仅适用于集合类型。load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.WorksheetCollection - Only available on collection types. 它类似于前面的签名。It is similar to the preceding signature. Top 指定结果中可包含的集合项的最大数量。Option.top specifies the maximum number of collection items that can be included in the result. 选项。 skip 指定要跳过且不包含在结果中的项目数。Option.skip specifies the number of items that are to be skipped and not included in the result. 如果指定了 top 选项, 则在跳过指定数目的项目后将启动结果集。If option.top is specified, the result set will start after skipping the specified number of items.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): Excel.WorksheetCollection;

参数

propertyNames
string | string[]

一个以逗号分隔的字符串或字符串数组, 用于指定要加载的属性。A comma-delimited string or an array of strings that specify the properties to load.

返回

示例Examples

Excel.run(function (ctx) { 
    var worksheets = ctx.workbook.worksheets;
    worksheets.load('items');
    return ctx.sync().then(function() {
        for (var i = 0; i < worksheets.items.length; i++)
        {
            console.log(worksheets.items[i].name);
            console.log(worksheets.items[i].index);
        }
    });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

load(option)

load(option?: OfficeExtension.LoadOption): Excel.WorksheetCollection;

参数

返回

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给它的对象的方法。尽管原始Excel.WorksheetCollection对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.WorksheetCollectionData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.WorksheetCollection object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.WorksheetCollectionData), 其中包含集合的项中所有加载属性的浅表副本的 "items" 数组。) that contains an "items" array with shallow copies of any loaded properties from the collection's items.

toJSON(): Excel.Interfaces.WorksheetCollectionData;

返回

事件详细信息

onActivated

当工作簿中的任何工作表激活时发生此事件。Occurs when any worksheet in the workbook is activated.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

readonly onActivated: OfficeExtension.EventHandlers<Excel.WorksheetActivatedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetActivatedEventArgs>

示例Examples

await Excel.run(async (context) => {
    let sheets = context.workbook.worksheets;
    sheets.onActivated.add(onActivate);

    await context.sync();
    console.log("A handler has been registered for the OnActivate event.");
});

onAdded

将新工作表添加到工作簿时发生此事件。Occurs when a new worksheet is added to the workbook.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

readonly onAdded: OfficeExtension.EventHandlers<Excel.WorksheetAddedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetAddedEventArgs>

示例Examples

await Excel.run(async (context) => {
    let sheet = context.workbook.worksheets;
    sheet.onAdded.add(onWorksheetAdd);

    await context.sync();
    console.log("A handler has been registered for the OnAdded event.");
});

onCalculated

计算工作簿中的任何工作表时发生。Occurs when any worksheet in the workbook is calculated.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

readonly onCalculated: OfficeExtension.EventHandlers<Excel.WorksheetCalculatedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetCalculatedEventArgs>

onChanged

在更改工作簿中的任何工作表时发生。Occurs when any worksheet in the workbook is changed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

readonly onChanged: OfficeExtension.EventHandlers<Excel.WorksheetChangedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetChangedEventArgs>

onColumnSorted

备注

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

对列进行排序时发生。Occurs when sorting on columns.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

readonly onColumnSorted: OfficeExtension.EventHandlers<Excel.WorksheetColumnSortedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetColumnSortedEventArgs>

onDeactivated

当工作簿中的任何工作表被停用时发生。Occurs when any worksheet in the workbook is deactivated.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

readonly onDeactivated: OfficeExtension.EventHandlers<Excel.WorksheetDeactivatedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetDeactivatedEventArgs>

示例Examples

await Excel.run(async (context) => {
    let sheets = context.workbook.worksheets;
    sheets.onDeactivated.add(onDeactivate);

    await context.sync();
    console.log("A handler has been registered for the OnDeactivate event.");
});

onDeleted

当从工作簿中删除工作表时发生此事件。Occurs when a worksheet is deleted from the workbook.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

readonly onDeleted: OfficeExtension.EventHandlers<Excel.WorksheetDeletedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetDeletedEventArgs>

onFiltered

备注

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

在工作簿中应用任何工作表的筛选器时发生。Occurs when any worksheet's filter is applied in the workbook.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

readonly onFiltered: OfficeExtension.EventHandlers<Excel.WorksheetFilteredEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetFilteredEventArgs>

onFormatChanged

在更改工作簿中的任何工作表的格式时发生。Occurs when any worksheet in the workbook has format changed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

readonly onFormatChanged: OfficeExtension.EventHandlers<Excel.WorksheetFormatChangedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetFormatChangedEventArgs>

onRowSorted

备注

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

对行进行排序时发生。Occurs when sorting on rows.

[API 集: EXCELAPI BETA (仅限预览)][ API set: ExcelApi BETA (PREVIEW ONLY) ]

readonly onRowSorted: OfficeExtension.EventHandlers<Excel.WorksheetRowSortedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetRowSortedEventArgs>

onSelectionChanged

在任何工作表上更改选择时发生。Occurs when the selection changes on any worksheet.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

readonly onSelectionChanged: OfficeExtension.EventHandlers<Excel.WorksheetSelectionChangedEventArgs>;

返回

OfficeExtension.EventHandlers<Excel.WorksheetSelectionChangedEventArgs>