PowerPoint.SlideLayoutCollection class

スライドのスライド マスターによって提供されるレイアウトのコレクションを表します。

Extends

注釈

[ API セット: PowerPointApi 1.3 ]

プロパティ

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

items

このコレクション内に読み込まれた子アイテムを取得します。

メソッド

getCount()

コレクション内のレイアウトの数を取得します。

getItem(key)

一意の ID を使用してレイアウトを取得します。

getItemAt(index)

コレクション内の 0 から始まるインデックスを使用してレイアウトを取得します。

getItemOrNullObject(id)

一意の ID を使用してレイアウトを取得します。 このようなレイアウトが存在しない場合は、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject メソッドとプロパティ」を参照してください。

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

toJSON()

API オブジェクトがJSON.stringify()に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (JSON.stringify、それに渡されるオブジェクトの toJSON メソッドを呼び出します)。元の PowerPoint.SlideLayoutCollection オブジェクトは API オブジェクトですが、 toJSON メソッドは、コレクションの項目から読み込まれたプロパティの浅いコピーを含む "items" 配列を含むプレーンな JavaScript オブジェクト ( PowerPoint.Interfaces.SlideLayoutCollectionDataとして型指定) を返します。

プロパティの詳細

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

items

このコレクション内に読み込まれた子アイテムを取得します。

readonly items: PowerPoint.SlideLayout[];

プロパティ値

メソッドの詳細

getCount()

コレクション内のレイアウトの数を取得します。

getCount(): OfficeExtension.ClientResult<number>;

戻り値

コレクション内のレイアウトの数。

注釈

[ API セット: PowerPointApi 1.3 ]

getItem(key)

一意の ID を使用してレイアウトを取得します。

getItem(key: string): PowerPoint.SlideLayout;

パラメーター

key

string

レイアウトの ID。

戻り値

一意の ID を持つレイアウト。 このようなレイアウトが存在しない場合は、エラーがスローされます。

注釈

[ API セット: PowerPointApi 1.3 ]

getItemAt(index)

コレクション内の 0 から始まるインデックスを使用してレイアウトを取得します。

getItemAt(index: number): PowerPoint.SlideLayout;

パラメーター

index

number

コレクション内のレイアウトのインデックス。

戻り値

指定されたインデックスのレイアウト。 インデックスが範囲外の場合、エラーがスローされます。

注釈

[ API セット: PowerPointApi 1.3 ]

getItemOrNullObject(id)

一意の ID を使用してレイアウトを取得します。 このようなレイアウトが存在しない場合は、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject メソッドとプロパティ」を参照してください。

getItemOrNullObject(id: string): PowerPoint.SlideLayout;

パラメーター

id

string

レイアウトの ID。

戻り値

一意の ID を持つレイアウト。

注釈

[ API セット: PowerPointApi 1.3 ]

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: PowerPoint.Interfaces.SlideLayoutCollectionLoadOptions & PowerPoint.Interfaces.CollectionLoadOptions): PowerPoint.SlideLayoutCollection;

パラメーター

options

PowerPoint.Interfaces.SlideLayoutCollectionLoadOptions & PowerPoint.Interfaces.CollectionLoadOptions

読み込むオブジェクトのプロパティのオプションを提供します。

戻り値

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames?: string | string[]): PowerPoint.SlideLayoutCollection;

パラメーター

propertyNames

string | string[]

読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。

戻り値

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/add-slides.yaml

await PowerPoint.run(async function(context) {
  // Load information about all the slide masters and associated layouts.
  const slideMasters = context.presentation.slideMasters.load("id, name, layouts/items/name, layouts/items/id");
  await context.sync();

  // Log the name and ID of each slide master.
  for (let i = 0; i < slideMasters.items.length; i++) {
    console.log("Master name: " + slideMasters.items[i].name);
    console.log("Master ID: " + slideMasters.items[i].id);

    // Log the name and ID of each slide layout in the slide master.
    const layoutsInMaster = slideMasters.items[i].layouts;
    for (let j = 0; j < layoutsInMaster.items.length; j++) {
      console.log("    Layout name: " + layoutsInMaster.items[j].name + " Layout ID: " + layoutsInMaster.items[j].id);
    }
  }
});

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths?: OfficeExtension.LoadOption): PowerPoint.SlideLayoutCollection;

パラメーター

propertyNamesAndPaths
OfficeExtension.LoadOption

propertyNamesAndPaths.select は読み込むプロパティを指定するコンマ区切りの文字列で、 propertyNamesAndPaths.expand は読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。

戻り値

toJSON()

API オブジェクトがJSON.stringify()に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (JSON.stringify、それに渡されるオブジェクトの toJSON メソッドを呼び出します)。元の PowerPoint.SlideLayoutCollection オブジェクトは API オブジェクトですが、 toJSON メソッドは、コレクションの項目から読み込まれたプロパティの浅いコピーを含む "items" 配列を含むプレーンな JavaScript オブジェクト ( PowerPoint.Interfaces.SlideLayoutCollectionDataとして型指定) を返します。

toJSON(): PowerPoint.Interfaces.SlideLayoutCollectionData;

戻り値