All Products
Search
Document Center

Intelligent Media Management:Page

Last Updated:Oct 29, 2024

This topic describes the API operations that are related to the Page object of a Word document.

Pages

ActiveDocument.ActiveWindow.ActivePane.Pages

Obtains all pages in a document.

Important
  • Only JS-SDK V1.1.10 and later support this feature.

  • The feature applies only to PCs.

  • Syntax

    expression.ActiveDocument.ActiveWindow.ActivePane.Pages

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain all pages in a document.
      const words = await app.ActiveDocument.ActiveWindow.ActivePane.Pages;
    }

Properties

ActiveDocument.ActiveWindow.ActivePane.Pages.Count

Obtains the number of pages in the collection in page layout view.

Important
  • Only JS-SDK V1.1.10 and later support this feature.

  • The feature applies only to PCs.

  • Syntax

    expression.ActiveDocument.ActiveWindow.ActivePane.Pages.Count

    expression: an Application object.

  • Return value

    A Number that indicates the total number of pages.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the total number of pages in the page layout view.
      const pages = await app.ActiveDocument.ActiveWindow.ActivePane.Pages.Count;
      console.log(pages);
    }

PageSetup

ActiveDocument.Sections.Item(Index).PageSetup

Obtains the PageSetup object for the specified section.

Important

Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    }

Methods

ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage()

Typesets to the specified page. Word documents use fluid typography. You need to specify PageNum, which specifies the number of the first page to load. Subsequent pages are loaded as you scroll the document.

Important

Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage(PageNum)

    expression: an Application object.

  • Parameters

    Parameter

    Type

    Required

    Description

    PageNum

    Number

    Yes

    The page number of the page to load initially.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Typeset to the specified page.
      await pageSetup.TypesetToPage(2);
    }

Properties

ActiveDocument.Sections.Item(Index).PageSetup.PageWidth

Obtains the width of the specified page.

Important

Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.PageWidth

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Obtain the width of the page.
      const pageWidth = await PageSetup.PageWidth;
      console.log(pageWidth);
    }

    ActiveDocument.Sections.Item(Index).PageSetup.PageHeight

    Obtains the height of the specified page.

    Important

    Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.PageHeight

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Obtain the page height.
      const PageHeight = await PageSetup.PageHeight;
      console.log(PageHeight);
    }

    ActiveDocument.Sections.Item(Index).PageSetup.TopMargin

  • Obtains the distance between the top edge of the page and the top boundary of the body text.

    Important

    Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.TopMargin

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Obtain the distance between the top edge of the page and the top boundary of the body text.
      const TopMargin = await PageSetup.TopMargin;
      console.log(TopMargin);
    }

    ActiveDocument.Sections.Item(Index).PageSetup.BottomMargin

  • Obtains the distance between the bottom edge of the page and the bottom boundary of the body text.

    Important

    Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.BottomMargin

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Obtain the distance between the bottom edge of the page and the bottom boundary of the body text.
      const BottomMargin = await PageSetup.BottomMargin;
      console.log(BottomMargin);
    }

    ActiveDocument.Sections.Item(Index).PageSetup.LeftMargin

  • Obtains the distance between the left edge of the page and the left boundary of the body text.

    Important

    Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.LeftMargin

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Obtain the distance between the left edge of the page and the left boundary of the body text.
      const LeftMargin = await PageSetup.LeftMargin;
      console.log(LeftMargin);
    }

    ActiveDocument.Sections.Item(Index).PageSetup.RightMargin

  • Obtains the distance between the right edge of the page and the right boundary of the body text.

    Important

    Only JS-SDK V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Sections.Item(Index).PageSetup.RightMargin

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the PageSetup object.
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // Obtain the distance between the right edge of the page and the right boundary of the body text.
      const RightMargin = await PageSetup.RightMargin;
      console.log(RightMargin);
    }