Excel.NamedSheetView class

Represents a named sheet view of a worksheet. A sheet view stores the sort and filter rules for a particular worksheet. Every sheet view (even a temporary sheet view) has a unique, worksheet-scoped name that is used to access the view.

Extends

Remarks

[ API set: ExcelApiOnline 1.1 ]

Properties

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

name

Gets or sets the name of the sheet view. The temporary sheet view name is the empty string (""). Naming the view by using the name property causes the sheet view to be saved.

Methods

activate()

Activates this sheet view. This is equivalent to using "Switch To" in the Excel UI.

delete()

Removes the sheet view from the worksheet.

duplicate(name)

Creates a copy of this sheet view.

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.NamedSheetView object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.NamedSheetViewData) that contains shallow copies of any loaded child properties from the original object.

Property Details

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

context: RequestContext;

Property Value

name

Gets or sets the name of the sheet view. The temporary sheet view name is the empty string (""). Naming the view by using the name property causes the sheet view to be saved.

name: string;

Property Value

string

Remarks

[ API set: ExcelApiOnline 1.1 ]

Method Details

activate()

Activates this sheet view. This is equivalent to using "Switch To" in the Excel UI.

activate(): void;

Returns

void

Remarks

[ API set: ExcelApiOnline 1.1 ]

delete()

Removes the sheet view from the worksheet.

delete(): void;

Returns

void

Remarks

[ API set: ExcelApiOnline 1.1 ]

duplicate(name)

Creates a copy of this sheet view.

duplicate(name?: string): Excel.NamedSheetView;

Parameters

name

string

The name of the duplicated sheet view. If no name is provided, one will be generated.

Returns

The new, duplicated sheet view.

Remarks

[ API set: ExcelApiOnline 1.1 ]

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(options?: Excel.Interfaces.NamedSheetViewLoadOptions): Excel.NamedSheetView;

Parameters

options
Excel.Interfaces.NamedSheetViewLoadOptions

Provides options for which properties of the object to load.

Returns

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

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

Parameters

propertyNames

string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Excel.NamedSheetView;

Parameters

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

Returns

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.NamedSheetView object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.NamedSheetViewData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Excel.Interfaces.NamedSheetViewData;

Returns