This topic describes the API operations that are related to the ActiveWindow object of presentation documents.
ActiveWindow
Obtains the ActiveWindow object of a presentation document.
Syntax
expression.ActiveWindow
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; }
View
ActiveWindow.View
Obtains the View object.
Syntax
expression.ActiveWindow.View
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the View object. const view = await activeWindow.View; }
Properties
ActiveWindow.View.Zoom
You can obtain and specify the percentage by which the document window is zoomed by using the Zoom
property.
Syntax
expression.ActiveWindow.View.Zoom
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the View object. const view = await activeWindow.View; // Obtain the percentage by which the document window is zoomed. The default value is 100. const result = await view.Zoom; console.log(result); // Specify the percentage by which the document window is zoomed. view.Zoom = 66; }
ActiveWindow.View.ZoomToFit
You can specify whether to zoom the view to fit the size of the document window by using the ZoomToFit
property after the document window is resized.
Syntax
expression.ActiveWindow.View.ZoomToFit = Number
expression: the application object of the document type.
Valid values of the Number parameter:
-1: zooms the view to fit the size of the document window after the document window is resized.
0: does not zoom the view to fit the size of the document window after the document window is resized.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the View object. const view = await activeWindow.View; // Obtain the percentage by which the document window is zoomed. The default value is 100. const result = await view.Zoom; console.log(result); // Specify the percentage by which the document window is zoomed. view.Zoom = 66; // Do not zoom the view to fit the size of the document window. view.ZoomToFit = 0; }
Selection
ActiveWindow.Selection
Specifies content in a document window.
Syntax
expression.ActiveWindow.Selection
expression: the application object of the document type.
Example
//@file=base.pptx async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the Selection object. const selection = await activeWindow.Selection; }
Methods
ActiveWindow.GetActiveShapeImg
Obtains the information about the selected image.
Syntax
expression.ActiveWindow.GetActiveShapeImg
expression: the application object of the document type.
Example
//@file=base.pptx async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the Selection object. const selection = await activeWindow.Selection; // Obtain the information about the selected image. const imgInfo = await selection.GetActiveShapeImg(); console.log('Image information:', imgInfo); }
ActiveWindow.Selection.ClearShapeSelect
Deselects the Selection object.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
expression.ActiveWindow.Selection.ClearShapeSelect
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the Selection object. const selection = await activeWindow.Selection; // Deselects the Selection object. 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.Copy
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the Selection object. const selection = await activeWindow.Selection; // Copy the selected slide. const data = await selection.Copy() }
ActiveWindow.Selection.Paste
Pastes the copied slide.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
expression.ActiveWindow.Selection.Paste
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ActiveWindow object. const activeWindow = await app.ActiveWindow; // Obtain the Selection object. const selection = await activeWindow.Selection; // Copy and paste the selected slide. const data = await selection.Copy() await selection.Paste(data) }
SlideRange
ActiveWindow.Selection.SlideRange
Obtains a collection of all slides in the selected range.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
expression.ActiveWindow.Selection.SlideRange
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the Presentation object. const presentation = await app.ActiveWindow.Selection; // Obtain the collection of all slides in the selected range. const view = await presentation.SlideRange; }
Method
ActiveWindow.Selection.SlideRange.Item()
You can obtain a single slide in the selected range by using the Item()
method.
Only JavaScript SDK V1.1.14 and later support this feature.
Parameter
Property
Data type
Required
Description
Index
Number
Yes
The index number of the slide.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the Presentation object. const presentation = await app.ActiveWindow.Selection; // Obtain the collection of all slides in the selected range. const view = await presentation.SlideRange; // Obtain a single slide. await app.ActiveWindow.Selection.SlideRange.Item(1); }
Property
ActiveWindow.Selection.SlideRange.Count
You can obtain the number of slides in the selected range by using the Count
property.
Only JavaScript SDK V1.1.14 and later support this feature.
Syntax
expression.ActiveWindow.Selection.SlideRange.Count
expression: the application object of the document type.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the Presentation object. const presentation = await app.ActiveWindow.Selection; // Obtain the collection of all slides in the selected range. const view = await presentation.SlideRange; // Obtain the number of slides in the selected range. const count = await app.ActiveWindow.Selection.SlideRange.Count console.log(count); }