This topic describes the API operations that are related to Zoom objects 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; // Obtain 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; // Specify that the view is not zoomed to fit the size of the window. 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; // Obtain the window zoom percentage. The default zoom percentage is 100%. const result = await app.ActiveDocument.ActiveWindow.View.Zoom.Percentage; console.log(result); // Set the window zoom percentage to 40% after 3,000 ms. setTimeout(() => { app.ActiveDocument.ActiveWindow.View.Zoom.Percentage = 40; }, 3000); }