このトピックでは、Word 文書の Page オブジェクトに関連する API 操作について説明します。
ページ
ActiveDocument.ActiveWindow.ActivePane.Pages
ドキュメント内のすべてのページを取得します。
JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
この機能は PC にのみ適用されます。
構文
expression.ActiveDocument.ActiveWindow.ActivePane.Pages
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // ドキュメント内のすべてのページを取得します。 const words = await app.ActiveDocument.ActiveWindow.ActivePane.Pages; }
プロパティ
ActiveDocument.ActiveWindow.ActivePane.Pages.Count
ページレイアウトビューでコレクション内のページ数を取得します。
JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
この機能は PC にのみ適用されます。
構文
expression.ActiveDocument.ActiveWindow.ActivePane.Pages.Count
expression: アプリケーション オブジェクト。
戻り値
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
指定されたセクションの PageSetup オブジェクトを取得します。
JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; }
メソッド
ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage()
指定されたページまで組版します。 Word 文書は流動的なタイポグラフィを使用します。
PageNum
を指定する必要があります。これは、読み込む最初のページの番号を指定します。後続のページは、ドキュメントをスクロールすると読み込まれます。
JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage(PageNum)
expression: アプリケーション オブジェクト。
パラメーター
パラメーター
タイプ
必須
説明
PageNum
数値
はい
最初に読み込むページのページ番号。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // 指定されたページまで組版します。 await pageSetup.TypesetToPage(2); }
プロパティ
ActiveDocument.Sections.Item(Index).PageSetup.PageWidth
指定されたページの幅を取得します。
JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.PageWidth
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // ページの幅を取得します。 const pageWidth = await PageSetup.PageWidth; console.log(pageWidth); }
ActiveDocument.Sections.Item(Index).PageSetup.PageHeight
指定されたページの高さを取得します。
重要JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.PageHeight
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // ページの高さを取得します。 const PageHeight = await PageSetup.PageHeight; console.log(PageHeight); }
ActiveDocument.Sections.Item(Index).PageSetup.TopMargin
ページの上端と本文の上端の間の距離を取得します。
重要JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.TopMargin
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // ページの上端と本文の上端の間の距離を取得します。 const TopMargin = await PageSetup.TopMargin; console.log(TopMargin); }
ActiveDocument.Sections.Item(Index).PageSetup.BottomMargin
ページの下端と本文の下端の間の距離を取得します。
重要JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.BottomMargin
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // ページの下端と本文の下端の間の距離を取得します。 const BottomMargin = await PageSetup.BottomMargin; console.log(BottomMargin); }
ActiveDocument.Sections.Item(Index).PageSetup.LeftMargin
ページの左端と本文の左端の間の距離を取得します。
重要JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.LeftMargin
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // ページの左端と本文の左端の間の距離を取得します。 const LeftMargin = await PageSetup.LeftMargin; console.log(LeftMargin); }
ActiveDocument.Sections.Item(Index).PageSetup.RightMargin
ページの右端と本文の右端の間の距離を取得します。
重要JS-SDK V1.1.10 以降でのみこの機能がサポートされています。
構文
expression.ActiveDocument.Sections.Item(Index).PageSetup.RightMargin
expression: アプリケーション オブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // PageSetup オブジェクトを取得します。 const PageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // ページの右端と本文の右端の間の距離を取得します。 const RightMargin = await PageSetup.RightMargin; console.log(RightMargin); }