Excel.Window class
Represents a window in the workbook.
- Extends
Remarks
Properties
| active |
Gets the active cell in the window. |
| active |
Gets the active pane in the window. |
| active |
Gets the active worksheet in the window. |
| auto |
Specifies whether AutoFilter date grouping is enabled in the window. |
| context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
| enable |
Specifies whether resizing is enabled for the window. |
| freeze |
Specifies whether panes are frozen in the window. |
| height | Specifies the height of the window. |
| index | Gets the index of the window. |
| is |
Specifies whether the window is visible. |
| left | Specifies the distance, in points, from the left edge of the computer screen to the left edge of the window. |
| name | Specifies the name of the window. |
| panes | Gets a collection of panes associated with the window. |
| scroll |
Specifies the scroll column of the window. |
| scroll |
Specifies the scroll row of the window. |
| show |
Specifies whether formulas are shown in the window. |
| show |
Specifies whether gridlines are shown in the window. |
| show |
Specifies whether headings are shown in the window. |
| show |
Specifies whether the horizontal scroll bar is shown in the window. |
| show |
Specifies whether outline is shown in the window. |
| show |
Gets the right-to-left layout value of the window. True means that the window is using right-to-left layout, false means that the window is using left-to-right layout. |
| show |
Specifies whether the ruler is shown in the window. |
| show |
Specifies whether the vertical scroll bar is shown in the window. |
| show |
Specifies whether whitespace is shown in the window. |
| show |
Specifies whether workbook tabs are shown in the window. |
| show |
Specifies whether zeroes are shown in the window. |
| split | Specifies the split state of the window. |
| split |
Specifies the split column of the window. |
| split |
Specifies the horizontal split of the window. |
| split |
Specifies the split row of the window. |
| split |
Specifies the vertical split of the window. |
| tab |
Specifies the tab ratio of the window. |
| top | Specifies the distance, in points, from the top edge of the window to the top edge of the usable area (below the menus, any toolbars docked at the top, and the formula bar). |
| type | Specifies the type of the window. |
| usable |
Gets the usable height of the window. |
| usable |
Gets the usable width of the window. |
| view | Specifies the view of the window. |
| visible |
Gets the visible range of the window. |
| width | Specifies the display width of the window. |
| window |
Gets the window number. |
| window |
Specifies the window state. |
| zoom | Specifies an integer value that represents the display size of the window. It can be set to a percentage between 10 and 400. |
Methods
| activate() | Activates the window. |
| activate |
Activates the next window. |
| activate |
Activates the previous window. |
| close() | Closes the window. |
| large |
Scrolls the window by multiple pages. The |
| load(options) | Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| new |
Opens a new Excel window. |
| points |
Converts horizontal points to screen pixels. |
| points |
Converts vertical points to screen pixels. |
| scroll |
Scrolls the window to bring the specified range into view. |
| scroll |
Scrolls the workbook tabs. |
| scroll |
Scrolls the workbook tabs. |
| set(properties, options) | Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. |
| set(properties) | Sets multiple properties on the object at the same time, based on an existing loaded object. |
| small |
Scrolls the window by a number of rows or columns. The |
| toJSON() | Overrides the JavaScript |
Property Details
activeCell
Gets the active cell in the window.
readonly activeCell: Excel.Range;
Property Value
Remarks
activePane
Gets the active pane in the window.
readonly activePane: Excel.Pane;
Property Value
Remarks
activeWorksheet
Gets the active worksheet in the window.
readonly activeWorksheet: Excel.Worksheet;
Property Value
Remarks
autoFilterDateGroupingEnabled
Specifies whether AutoFilter date grouping is enabled in the window.
autoFilterDateGroupingEnabled: boolean;
Property Value
boolean
Remarks
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
enableResize
Specifies whether resizing is enabled for the window.
readonly enableResize: boolean;
Property Value
boolean
Remarks
freezePanes
Specifies whether panes are frozen in the window.
freezePanes: boolean;
Property Value
boolean
Remarks
height
Specifies the height of the window.
height: number;
Property Value
number
Remarks
index
Gets the index of the window.
readonly index: number;
Property Value
number
Remarks
isVisible
Specifies whether the window is visible.
isVisible: boolean;
Property Value
boolean
Remarks
left
Specifies the distance, in points, from the left edge of the computer screen to the left edge of the window.
left: number;
Property Value
number
Remarks
name
Specifies the name of the window.
name: string;
Property Value
string
Remarks
panes
Gets a collection of panes associated with the window.
readonly panes: Excel.PaneCollection;
Property Value
Remarks
scrollColumn
Specifies the scroll column of the window.
scrollColumn: number;
Property Value
number
Remarks
scrollRow
Specifies the scroll row of the window.
scrollRow: number;
Property Value
number
Remarks
showFormulas
Specifies whether formulas are shown in the window.
showFormulas: boolean;
Property Value
boolean
Remarks
showGridlines
Specifies whether gridlines are shown in the window.
showGridlines: boolean;
Property Value
boolean
Remarks
showHeadings
Specifies whether headings are shown in the window.
showHeadings: boolean;
Property Value
boolean
Remarks
showHorizontalScrollBar
Specifies whether the horizontal scroll bar is shown in the window.
showHorizontalScrollBar: boolean;
Property Value
boolean
Remarks
showOutline
Specifies whether outline is shown in the window.
showOutline: boolean;
Property Value
boolean
Remarks
showRightToLeft
Gets the right-to-left layout value of the window. True means that the window is using right-to-left layout, false means that the window is using left-to-right layout.
readonly showRightToLeft: boolean;
Property Value
boolean
Remarks
showRuler
Specifies whether the ruler is shown in the window.
showRuler: boolean;
Property Value
boolean
Remarks
showVerticalScrollBar
Specifies whether the vertical scroll bar is shown in the window.
showVerticalScrollBar: boolean;
Property Value
boolean
Remarks
showWhitespace
Specifies whether whitespace is shown in the window.
showWhitespace: boolean;
Property Value
boolean
Remarks
showWorkbookTabs
Specifies whether workbook tabs are shown in the window.
showWorkbookTabs: boolean;
Property Value
boolean
Remarks
showZeros
Specifies whether zeroes are shown in the window.
showZeros: boolean;
Property Value
boolean
Remarks
split
Specifies the split state of the window.
split: boolean;
Property Value
boolean
Remarks
splitColumn
Specifies the split column of the window.
splitColumn: number;
Property Value
number
Remarks
splitHorizontal
Specifies the horizontal split of the window.
splitHorizontal: number;
Property Value
number
Remarks
splitRow
Specifies the split row of the window.
splitRow: number;
Property Value
number
Remarks
splitVertical
Specifies the vertical split of the window.
splitVertical: number;
Property Value
number
Remarks
tabRatio
Specifies the tab ratio of the window.
tabRatio: number;
Property Value
number
Remarks
top
Specifies the distance, in points, from the top edge of the window to the top edge of the usable area (below the menus, any toolbars docked at the top, and the formula bar).
top: number;
Property Value
number
Remarks
type
Specifies the type of the window.
readonly type: Excel.WindowType | "chartAsWindow" | "chartInPlace" | "clipboard" | "workbook";
Property Value
Excel.WindowType | "chartAsWindow" | "chartInPlace" | "clipboard" | "workbook"
Remarks
usableHeight
Gets the usable height of the window.
readonly usableHeight: number;
Property Value
number
Remarks
usableWidth
Gets the usable width of the window.
readonly usableWidth: number;
Property Value
number
Remarks
view
Specifies the view of the window.
view: Excel.WindowView | "normalView" | "pageBreakPreview" | "pageLayoutView";
Property Value
Excel.WindowView | "normalView" | "pageBreakPreview" | "pageLayoutView"
Remarks
visibleRange
Gets the visible range of the window.
readonly visibleRange: Excel.Range;
Property Value
Remarks
width
Specifies the display width of the window.
width: number;
Property Value
number
Remarks
windowNumber
Gets the window number.
readonly windowNumber: number;
Property Value
number
Remarks
windowState
Specifies the window state.
windowState: Excel.WindowState | "maximized" | "minimized" | "normal";
Property Value
Excel.WindowState | "maximized" | "minimized" | "normal"
Remarks
zoom
Specifies an integer value that represents the display size of the window. It can be set to a percentage between 10 and 400.
zoom: number;
Property Value
number
Remarks
Method Details
activate()
activateNext()
Activates the next window.
activateNext(): void;
Returns
void
Remarks
activatePrevious()
Activates the previous window.
activatePrevious(): void;
Returns
void
Remarks
close()
Closes the window.
close(): OfficeExtension.ClientResult<boolean>;
Returns
OfficeExtension.ClientResult<boolean>
Remarks
largeScroll(Down, Up, ToRight, ToLeft)
Scrolls the window by multiple pages. The down, up, toRight, and toLeft parameters correspond to the action of scrolling with Page Down, Page Up, Alt+Page Down, and Alt+Page Up keys on the keyboard.
largeScroll(Down: number, Up: number, ToRight: number, ToLeft: number): void;
Parameters
- Down
-
number
- Up
-
number
- ToRight
-
number
- ToLeft
-
number
Returns
void
Remarks
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.WindowLoadOptions): Excel.Window;
Parameters
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.Window;
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.Window;
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
newWindow()
Opens a new Excel window.
newWindow(): Excel.Window;
Returns
Remarks
pointsToScreenPixelsX(Points)
Converts horizontal points to screen pixels.
pointsToScreenPixelsX(Points: number): OfficeExtension.ClientResult<number>;
Parameters
- Points
-
number
Returns
OfficeExtension.ClientResult<number>
Remarks
pointsToScreenPixelsY(Points)
Converts vertical points to screen pixels.
pointsToScreenPixelsY(Points: number): OfficeExtension.ClientResult<number>;
Parameters
- Points
-
number
Returns
OfficeExtension.ClientResult<number>
Remarks
scrollIntoView(Left, Top, Width, Height, Start)
Scrolls the window to bring the specified range into view.
scrollIntoView(Left: number, Top: number, Width: number, Height: number, Start?: boolean): void;
Parameters
- Left
-
number
- Top
-
number
- Width
-
number
- Height
-
number
- Start
-
boolean
Returns
void
Remarks
scrollWorkbookTabs(Sheets, Position)
Scrolls the workbook tabs.
scrollWorkbookTabs(Sheets?: number, Position?: Excel.ScrollWorkbookTabPosition): void;
Parameters
- Sheets
-
number
- Position
- Excel.ScrollWorkbookTabPosition
Returns
void
Remarks
scrollWorkbookTabs(Sheets, Position)
Scrolls the workbook tabs.
scrollWorkbookTabs(Sheets?: number, Position?: "First" | "Last"): void;
Parameters
- Sheets
-
number
- Position
-
"First" | "Last"
Returns
void
Remarks
set(properties, options)
Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.
set(properties: Interfaces.WindowUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Excel.Interfaces.WindowUpdateData
A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.
- options
- OfficeExtension.UpdateOptions
Provides an option to suppress errors if the properties object tries to set any read-only properties.
Returns
void
set(properties)
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Excel.Window): void;
Parameters
- properties
- Excel.Window
Returns
void
smallScroll(Down, Up, ToRight, ToLeft)
Scrolls the window by a number of rows or columns. The down, up, toRight, and toLeft parameters correspond to the action of scrolling with arrow keys on the keyboard.
smallScroll(Down: number, Up: number, ToRight: number, ToLeft: number): void;
Parameters
- Down
-
number
- Up
-
number
- ToRight
-
number
- ToLeft
-
number
Returns
void
Remarks
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's passed to it.) Whereas the original Excel.Window object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.WindowData) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Excel.Interfaces.WindowData;