PowerPoint.HyperlinkCollection class

ハイパーリンクのコレクションを表します。

Extends

注釈

API セット: PowerPointApi 1.6

使用元

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/hyperlinks/manage-hyperlinks.yaml

// Gets the hyperlinks found in the first selected slide.
await PowerPoint.run(async (context) => {
  const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
  const hyperlinks: PowerPoint.HyperlinkCollection = slide.hyperlinks.load("address,screenTip");
  const hyperlinksCount = hyperlinks.getCount();
  await context.sync();

  console.log(
    `${hyperlinksCount.value} hyperlinks found in first selected slide${hyperlinksCount.value === 0 ? "." : ":"}`,
  );
  for (let link of hyperlinks.items) {
    console.log(`Address: "${link.address}" (screen tip: "${link.screenTip}").`);
  }
});

プロパティ

context

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

items

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

メソッド

add(target, options)

指定されたオプションを使用して、指定したターゲットにハイパーリンクを追加します。 ターゲットに既にハイパーリンクが含まれている場合は、削除されます。 新しいハイパーリンクはコレクション内の任意の場所に表示でき、末尾に追加される保証はありません。

getCount()

コレクション内のハイパーリンクの数を取得します。

getItemAt(index)

コレクション内の 0 から始まるインデックスを使用してハイパーリンクを取得します。 インデックスが範囲外の場合は、 InvalidArgument 例外をスローします。

load(options)

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

load(propertyNames)

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

load(propertyNamesAndPaths)

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

toJSON()

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

プロパティの詳細

context

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

context: RequestContext;

プロパティ値

items

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

readonly items: PowerPoint.Hyperlink[];

プロパティ値

メソッドの詳細

add(target, options)

指定されたオプションを使用して、指定したターゲットにハイパーリンクを追加します。 ターゲットに既にハイパーリンクが含まれている場合は、削除されます。 新しいハイパーリンクはコレクション内の任意の場所に表示でき、末尾に追加される保証はありません。

add(target: TextRange | Shape, options?: PowerPoint.HyperlinkAddOptions): PowerPoint.Hyperlink;

パラメーター

target

PowerPoint.TextRange | PowerPoint.Shape

ハイパーリンクを追加するターゲット。 PowerPoint.TextRange または PowerPoint.Shape を指定できます。

options
PowerPoint.HyperlinkAddOptions

省略可能。 ハイパーリンクのオプション

返品

新しく作成された PowerPoint.Hyperlink オブジェクト。

注釈

API セット: PowerPointApi 1.10

getCount()

コレクション内のハイパーリンクの数を取得します。

getCount(): OfficeExtension.ClientResult<number>;

返品

コレクション内のハイパーリンクの数。

注釈

API セット: PowerPointApi 1.6

getItemAt(index)

コレクション内の 0 から始まるインデックスを使用してハイパーリンクを取得します。 インデックスが範囲外の場合は、 InvalidArgument 例外をスローします。

getItemAt(index: number): PowerPoint.Hyperlink;

パラメーター

index

number

コレクション内のハイパーリンクのインデックス。

返品

指定されたインデックスのハイパーリンク。

注釈

API セット: PowerPointApi 1.6

load(options)

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

load(options?: PowerPoint.Interfaces.HyperlinkCollectionLoadOptions & PowerPoint.Interfaces.CollectionLoadOptions): PowerPoint.HyperlinkCollection;

パラメーター

options

PowerPoint.Interfaces.HyperlinkCollectionLoadOptions & PowerPoint.Interfaces.CollectionLoadOptions

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

返品

load(propertyNames)

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

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

パラメーター

propertyNames

string | string[]

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

返品

load(propertyNamesAndPaths)

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

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

パラメーター

propertyNamesAndPaths
OfficeExtension.LoadOption

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

返品

toJSON()

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

toJSON(): PowerPoint.Interfaces.HyperlinkCollectionData;

返品