Zoom
API operations for the Zoom object in Word documents.
ActiveDocument.ActiveWindow.View.Zoom
Returns a Zoom object.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.ActiveWindow.View.Zoomexpression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get a Zoom object. const Zoom = await app.ActiveDocument.ActiveWindow.View.Zoom; }
ActiveDocument.ActiveWindow.View.Zoom.PageFit
Sets whether to zoom the view to fit the size of the window.
-
Syntax
expression.ActiveDocument.ActiveWindow.View.Zoom.PageFit = Numberexpression: an Application object.
Valid values of the Number parameter:
0: does not zoom the view to fit the size of the document window after the document window is resized.
2: zooms the view to fit the resized window.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Disable auto-fit: the view does not resize when the window changes. app.ActiveDocument.ActiveWindow.View.Zoom.PageFit = 0; }
ActiveDocument.ActiveWindow.View.Zoom.Percentage
Sets or returns the zoom percentage for a window.
Only WebOffice for PCs supports a window zoom percentage.
-
Syntax
expression.ActiveDocument.ActiveWindow.View.Zoom.Percentageexpression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the current zoom percentage (defaults to 100%). const result = await app.ActiveDocument.ActiveWindow.View.Zoom.Percentage; console.log(result); // Set the zoom percentage to 40% after 3,000 ms. setTimeout(() => { app.ActiveDocument.ActiveWindow.View.Zoom.Percentage = 40; }, 3000); }