PowerPoint.HyperlinkAddOptions interface

表示添加 PowerPoint.Hyperlink 时可用的选项。

注解

[ API 集:PowerPointApi 1.10 ]

示例

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

// Sets a hyperlink on the selected text range.
await PowerPoint.run(async (context) => {
  const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
  const textRange: PowerPoint.TextRange = context.presentation.getSelectedTextRange().load("text");
  const hyperlinks: PowerPoint.HyperlinkCollection = slide.hyperlinks;
  const hyperlinkAddOptions: PowerPoint.HyperlinkAddOptions = {
    address: "https://bing.com",
    screenTip: "Screen tip for text",
  };
  let hyperlink: PowerPoint.Hyperlink = hyperlinks.add(textRange, hyperlinkAddOptions).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 on the active slide.",
    );
    return;
  }

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

属性

address

指定超链接的地址,可以是 URL、文件名或文件路径,也可以是具有 mailto URI 方案的电子邮件地址。

screenTip

指定将鼠标悬停在超链接上时显示的字符串。

属性详细信息

address

指定超链接的地址,可以是 URL、文件名或文件路径,也可以是具有 mailto URI 方案的电子邮件地址。

address?: string;

属性值

string

注解

[ API 集:PowerPointApi 1.10 ]

screenTip

指定将鼠标悬停在超链接上时显示的字符串。

screenTip?: string;

属性值

string

注解

[ API 集:PowerPointApi 1.10 ]