Excel.RangeHyperlink interface

Representa as cadeias de caracteres necessárias para obter/definir um objeto HYPERLINK (XHL).

Propriedades

address

Representa o destino da url do hiperlink.

documentReference

Representa o destino de referência de documento para o hiperlink.

screenTip

Representa a cadeia exibida ao passar o mouse sobre o hiperlink.

textToDisplay

Representa a cadeia de caracteres exibida na parte superior esquerda da maioria das células no intervalo.

Detalhes da propriedade

address

Representa o destino da url do hiperlink.

address?: string;

Valor da propriedade

string

Exemplos

async function main(context: Excel.RequestContext) {
    let sheet = context.workbook.worksheets.getItem("Orders");

    let productsRange = sheet.getRange("A3:A5");
    productsRange.load("values");

    await context.sync();

    // Create a hyperlink to a URL 
    // for each product name in the first table.
    for (let i = 0; i < productsRange.values.length; i++) {
        let cellRange = productsRange.getCell(i, 0);
        let cellText = productsRange.values[i][0];

        let hyperlink = {
            textToDisplay: cellText,
            screenTip: "Search Bing for '" + cellText + "'",
            address: "https://www.bing.com?q=" + cellText
        }
        cellRange.hyperlink = hyperlink;
    }

    await context.sync();
}

documentReference

Representa o destino de referência de documento para o hiperlink.

documentReference?: string;

Valor da propriedade

string

Exemplos

async function main(context: Excel.RequestContext) {
    let sheet = context.workbook.worksheets.getItem("Orders");

    let productsRange = sheet.getRange("A9:A11");
    productsRange.load("values");

    await context.sync();

    // Create a hyperlink to a location within the workbook
    // for each product name in the second table.
    for (let i = 0; i < productsRange.values.length; i++) {
        let cellRange = productsRange.getCell(i, 0);
        let cellText = productsRange.values[i][0];

        let hyperlink = {
            textToDisplay: cellText,
            screenTip: "Navigate to the '" + cellText + "' worksheet",
            documentReference: cellText + "!A1"
        }
        cellRange.hyperlink = hyperlink;
    }

    await context.sync();
}

screenTip

Representa a cadeia exibida ao passar o mouse sobre o hiperlink.

screenTip?: string;

Valor da propriedade

string

Exemplos

async function main(context: Excel.RequestContext) {
    let sheet = context.workbook.worksheets.getItem("Orders");

    let productsRange = sheet.getRange("A3:A5");
    productsRange.load("values");

    await context.sync();

    // Create a hyperlink to a URL 
    // for each product name in the first table.
    for (let i = 0; i < productsRange.values.length; i++) {
        let cellRange = productsRange.getCell(i, 0);
        let cellText = productsRange.values[i][0];

        let hyperlink = {
            textToDisplay: cellText,
            screenTip: "Search Bing for '" + cellText + "'",
            address: "https://www.bing.com?q=" + cellText
        }
        cellRange.hyperlink = hyperlink;
    }

    await context.sync();
}

textToDisplay

Representa a cadeia de caracteres exibida na parte superior esquerda da maioria das células no intervalo.

textToDisplay?: string;

Valor da propriedade

string

Exemplos

async function main(context: Excel.RequestContext) {
    let sheet = context.workbook.worksheets.getItem("Orders");

    let productsRange = sheet.getRange("A3:A5");
    productsRange.load("values");

    await context.sync();

    // Create a hyperlink to a URL 
    // for each product name in the first table.
    for (let i = 0; i < productsRange.values.length; i++) {
        let cellRange = productsRange.getCell(i, 0);
        let cellText = productsRange.values[i][0];

        let hyperlink = {
            textToDisplay: cellText,
            screenTip: "Search Bing for '" + cellText + "'",
            address: "https://www.bing.com?q=" + cellText
        }
        cellRange.hyperlink = hyperlink;
    }

    await context.sync();
}