全部產品
Search
文件中心

Intelligent Media Management:Page

更新時間:Oct 30, 2024

本文介紹與文字文檔Page相關的API。

Pages

ActiveDocument.ActiveWindow.ActivePane.Pages

擷取文檔中的所有頁面。

重要
  • JS-SDK V1.1.10及以上版本支援此功能。

  • 僅PC端支援此功能。

  • 文法

    運算式.ActiveDocument.ActiveWindow.ActivePane.Pages

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //擷取文檔中的所有頁面
      const words = await app.ActiveDocument.ActiveWindow.ActivePane.Pages;
    }

屬性

ActiveDocument.ActiveWindow.ActivePane.Pages.Count

通過Count屬性,您可以擷取分頁模式下的總頁數。

重要
  • JS-SDK V1.1.10及以上版本支援此功能。

  • 僅PC端支援此功能。

  • 文法

    運算式.ActiveDocument.ActiveWindow.ActivePane.Pages.Count

    運算式:文件類型應用對象

  • 傳回值

    返回Number表示總頁數。

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //擷取分頁模式下的總頁數
      const pages = await app.ActiveDocument.ActiveWindow.ActivePane.Pages.Count;
      console.log(pages);
    }

PageSetup

ActiveDocument.Sections.Item(Index).PageSetup

擷取頁面屬性對象。

重要

JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //擷取頁面屬性對象
      const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    }

方法

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

通過TypesetToPage()方法,您可以排版到指定頁。由於文字文檔是流式排版,因此需要通過PageNum來指定首次載入的頁數,滾動頁面時進一步載入頁面資料。

重要

JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage(PageNum)

    運算式:文件類型應用對象

  • 參數

    屬性

    資料類型

    是否必填

    描述

    PageNum

    Number

    指定首次載入的頁數。

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //擷取頁面屬性對象
      const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      //排版到指定頁
      await pageSetup.TypesetToPage(2);
    }

屬性

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

通過PageWidth屬性,您可以擷取頁面寬度。

重要

JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.PageWidth

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //擷取頁面屬性對象
      const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      //擷取頁面寬度
      const pageWidth = await PageSetup.PageWidth;
      console.log(pageWidth);
    }

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

    通過PageHeight屬性,您可以擷取頁面高度。

    重要

    JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.PageHeight

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // 頁面屬性對象
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // 擷取頁面高度
      const PageHeight = await PageSetup.PageHeight;
      console.log(PageHeight);
    }

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

  • 通過TopMargin屬性,您可以擷取頁面上邊緣與本文的上邊界之間的距離。

    重要

    JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.TopMargin

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // 頁面屬性對象
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // 擷取頁面上邊緣與本文的上邊界之間的距離
      const TopMargin = await PageSetup.TopMargin;
      console.log(TopMargin);
    }

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

  • 通過BottomMargin屬性,您可以擷取頁面底邊與本文邊界之間的距離。

    重要

    JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.BottomMargin

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // 頁面屬性對象
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // 擷取頁面底邊與本文邊界之間的距離
      const BottomMargin = await PageSetup.BottomMargin;
      console.log(BottomMargin);
    }

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

  • 通過LeftMargin屬性,您可以擷取頁面左邊緣與本文左邊界之間的距離。

    重要

    JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.BottomMargin

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // 頁面屬性對象
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // 擷取頁面左邊緣與本文左邊界之間的距離
      const LeftMargin = await PageSetup.LeftMargin;
      console.log(LeftMargin);
    }

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

  • 通過LeftMargin屬性,您可以擷取頁面右邊距與本文右邊界之間的距離。

    重要

    JS-SDK V1.1.10及以上版本支援此功能。

  • 文法

    運算式.ActiveDocument.Sections.Item(Index).PageSetup.RightMargin

    運算式:文件類型應用對象

  • 樣本

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // 頁面屬性對象
      const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup;
    
      // 擷取頁面右邊距與本文右邊界之間的距離
      const RightMargin = await PageSetup.RightMargin;
      console.log(RightMargin);
    }