ExcelScript.RangeHyperlink interface

Представляет строки, необходимые для получения или задания объекта гиперссылки (XHL).

Комментарии

Примеры

/**
 * This script puts a link to a webpage in a cell.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first cell in the current worksheet.
  const cell = workbook.getActiveWorksheet().getCell(0,0);

  // Create a link to a webpage.
  const sampleHyperlink : ExcelScript.RangeHyperlink = {
    address: "https://learn.microsoft.com/office/dev/scripts/resources/samples/table-of-contents",
    screenTip: "Sample: Create a workbook table of contents",
    textToDisplay: "Learn how to make a workbook table of contents"
  }

  // Put the link in the cell and format the width to fit.
  cell.setHyperlink(sampleHyperlink);
  cell.getFormat().autofitColumns();
}

Свойства

address

Представляет целевой URL-адрес гиперссылки.

documentReference

Представляет целевой объект ссылки на документ для гиперссылки.

screenTip

Представляет строку, отображаемую при наведении указателя на гиперссылку.

textToDisplay

Представляет строку, отображаемую в верхней левой ячейке диапазона.

Сведения о свойстве

Представляет целевой URL-адрес гиперссылки.

address?: string;

Значение свойства

string

Представляет целевой объект ссылки на документ для гиперссылки.

documentReference?: string;

Значение свойства

string

Примеры

/**
 * This script creates a hyperlink in the current cell to a table.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the selected cell.
  const selectedCell = workbook.getActiveCell();

  // Create a hyperlink from the current cell to a table named "Resources".
  const link : ExcelScript.RangeHyperlink = {
    documentReference: "Resources",
    screenTip: "Resources table",
    textToDisplay: "Go to table"
  } ;

  selectedCell.setHyperlink(link)
}

Представляет строку, отображаемую при наведении указателя на гиперссылку.

screenTip?: string;

Значение свойства

string

Представляет строку, отображаемую в верхней левой ячейке диапазона.

textToDisplay?: string;

Значение свойства

string