PowerPoint.Hyperlink class

1 つのハイパーリンクを表します。

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}").`);
  }
});

プロパティ

address

ハイパーリンクのアドレス (URL、ファイル名、ファイル パス、または mailto URI スキームを持つ電子メール アドレス) を指定します。

context

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

screenTip

ハイパーリンクにカーソルを合わせたときに表示される文字列を指定します。

type

ハイパーリンクが適用されているオブジェクトの型を返します。 詳細については、「 PowerPoint.HyperlinkType 」を参照してください。

メソッド

delete()

ハイパーリンクを削除します。

getLinkedShapeOrNullObject()

ハイパーリンクが適用されている PowerPoint.Shape オブジェクトを返します。 ハイパーリンクの種類が shape でない場合、または PowerPoint.Shape を現在サポートしていないドメイン内にある場合は、 isNullObject プロパティが true に設定されたオブジェクトをこのメソッドで返します。 詳細については、「 *OrNullObject のメソッドとプロパティ」を参照してください。

getLinkedTextRangeOrNullObject()

ハイパーリンクが適用されている PowerPoint.TextRange オブジェクトを返します。 ハイパーリンクが textRange 型ではない場合、または PowerPoint.TextRange を現在サポートしていないドメイン内にある場合、このメソッドは 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.Hyperlink オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( PowerPoint.Interfaces.HyperlinkData と型指定) を返します。

プロパティの詳細

ハイパーリンクのアドレス (URL、ファイル名、ファイル パス、または mailto URI スキームを持つ電子メール アドレス) を指定します。

address: string;

プロパティ値

string

注釈

API セット: PowerPointApi 1.6

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

context: RequestContext;

プロパティ値

ハイパーリンクにカーソルを合わせたときに表示される文字列を指定します。

screenTip: string;

プロパティ値

string

注釈

API セット: PowerPointApi 1.6

ハイパーリンクが適用されているオブジェクトの型を返します。 詳細については、「 PowerPoint.HyperlinkType 」を参照してください。

readonly type: PowerPoint.HyperlinkType | "TextRange" | "Shape";

プロパティ値

PowerPoint.HyperlinkType | "TextRange" | "Shape"

注釈

API セット: PowerPointApi 1.10

メソッドの詳細

ハイパーリンクを削除します。

delete(): void;

返品

void

注釈

API セット: PowerPointApi 1.10

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

// Deletes the first hyperlink found in the selected text on the current slide.
await PowerPoint.run(async (context) => {
  const textRange: PowerPoint.TextRange = context.presentation.getSelectedTextRange().load("text");
  let hyperlink: PowerPoint.Hyperlink = textRange.hyperlinks.getItemAt(0).load("address,screenTip");
  try {
    await context.sync();
  } catch {
    console.warn(
      "Confirm that you have at least one slide and you've selected a contiguous range of text containing at least one hyperlink on the active slide.",
    );
    return;
  }

  console.log(
    `About to delete first link "${hyperlink.address}" (screen tip: "${hyperlink.screenTip}") found in the selected text "${textRange.text}".`,
  );

  hyperlink.delete();

  console.log(`Deleted first link found in the selected text "${textRange.text}".`);
});

ハイパーリンクが適用されている PowerPoint.Shape オブジェクトを返します。 ハイパーリンクの種類が shape でない場合、または PowerPoint.Shape を現在サポートしていないドメイン内にある場合は、 isNullObject プロパティが true に設定されたオブジェクトをこのメソッドで返します。 詳細については、「 *OrNullObject のメソッドとプロパティ」を参照してください。

getLinkedShapeOrNullObject(): PowerPoint.Shape;

返品

注釈

API セット: PowerPointApi 1.10

ハイパーリンクが適用されている PowerPoint.TextRange オブジェクトを返します。 ハイパーリンクが textRange 型ではない場合、または PowerPoint.TextRange を現在サポートしていないドメイン内にある場合、このメソッドは isNullObject プロパティが true に設定されたオブジェクトを返します。 詳細については、「 *OrNullObject のメソッドとプロパティ」を参照してください。

getLinkedTextRangeOrNullObject(): PowerPoint.TextRange;

返品

注釈

API セット: PowerPointApi 1.10

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

load(options?: PowerPoint.Interfaces.HyperlinkLoadOptions): PowerPoint.Hyperlink;

パラメーター

options
PowerPoint.Interfaces.HyperlinkLoadOptions

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

返品

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

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

パラメーター

propertyNames

string | string[]

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

返品

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

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): PowerPoint.Hyperlink;

パラメーター

propertyNamesAndPaths

{ select?: string; expand?: string; }

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

返品

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

toJSON(): PowerPoint.Interfaces.HyperlinkData;

返品