ActiveWindow
API reference for the ActiveWindow object and its child objects in presentation documents.
ActiveWindow
Returns the ActiveWindow object of a presentation document.
Properties
|
Property |
Description |
|
View |
Returns the View object for controlling the document window display. |
Syntax
-
expression.ActiveWindowexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; }
View
ActiveWindow.View
Returns the View object.
Properties
|
Property |
Description |
|
Zoom |
Returns or sets the zoom percentage of the view. |
|
ZoomToFit |
Sets whether to auto-fit the view to the document window after the window is resized. |
Syntax
-
expression.ActiveWindow.Viewexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the View object. const view = await activeWindow.View; }
Properties
ActiveWindow.View.Zoom
Returns or sets the zoom percentage of the specified view.
Syntax
-
expression.ActiveWindow.View.Zoomexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the View object. const view = await activeWindow.View; // Get the current zoom percentage. The default value is 100. const result = await view.Zoom; console.log(result); // Set the zoom percentage to 66%. view.Zoom = 66; }
ActiveWindow.View.ZoomToFit
Sets whether to auto-fit the view to the document window size after the window is resized.
Syntax
-
expression.ActiveWindow.View.ZoomToFit = Numberexpression: the application object of the document type.
Valid values:
-
-1: auto-fits the view to the document window after the window is resized.
-
0: keeps the current zoom level when the document window is resized.
-
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the View object. const view = await activeWindow.View; // Keep the current zoom level when the window is resized. view.ZoomToFit = 0; }
Selection
ActiveWindow.Selection
Returns the Selection object, which represents the selected content in a document window.
Methods
|
Method |
Description |
|
ClearShapeSelect |
Deselects the current selection. |
|
Copy |
Copies the selected slide. |
|
Paste |
Pastes a previously copied slide. |
Properties
|
Property |
Description |
|
SlideRange |
Returns a collection of all slides in the selected range. |
Syntax
-
expression.ActiveWindow.Selectionexpression: the application object of the document type.
-
Example
//@file=base.pptx async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the Selection object. const selection = await activeWindow.Selection; }
Methods
ActiveWindow.Selection.ClearShapeSelect
Deselects the Selection object.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
-
expression.ActiveWindow.Selection.ClearShapeSelectexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the Selection object. const selection = await activeWindow.Selection; // Deselect all selected shapes. await selection.ClearShapeSelect(); }
ActiveWindow.Selection.Copy
Copies the selected slide.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
-
expression.ActiveWindow.Selection.Copyexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the Selection object. const selection = await activeWindow.Selection; // Copy the selected slide. const data = await selection.Copy(); }
ActiveWindow.Selection.Paste
Pastes a previously copied slide.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
-
expression.ActiveWindow.Selection.Pasteexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the document window object. const activeWindow = await app.ActiveWindow; // Get the Selection object. const selection = await activeWindow.Selection; // Copy the selected slide, then paste it. const data = await selection.Copy(); await selection.Paste(data); }
SlideRange
ActiveWindow.Selection.SlideRange
Returns a collection of all slides in the selected range.
Only JavaScript SDK V1.1.14 and later support this feature.
Methods
|
Method |
Description |
|
Item(Index) |
Returns a single slide by its index in the selected range. |
Properties
|
Property |
Description |
|
Count |
Returns the number of slides in the selected range. |
Syntax
-
expression.ActiveWindow.Selection.SlideRangeexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the Selection object. const selection = await app.ActiveWindow.Selection; // Get all slides in the selected range. const slideRange = await selection.SlideRange; }
Method
ActiveWindow.Selection.SlideRange.Item()
Returns a single slide at the specified index in the selected range.
Only JavaScript SDK V1.1.14 and later support this feature.
Parameters
-
Parameter
Data type
Default value
Required
Description
Index
Number
-
Yes
The 1-based index of the slide in the selected range.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the Selection object. const selection = await app.ActiveWindow.Selection; // Get all slides in the selected range. const slideRange = await selection.SlideRange; // Get the first slide in the selected range. const slide = await slideRange.Item(1); }
Property
ActiveWindow.Selection.SlideRange.Count
Returns the number of slides in the selected range.
Return value: Number
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
-
expression.ActiveWindow.Selection.SlideRange.Countexpression: the application object of the document type.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the Selection object. const selection = await app.ActiveWindow.Selection; // Get all slides in the selected range. const slideRange = await selection.SlideRange; // Get the number of slides in the selected range. const count = await slideRange.Count; console.log(count); }