Hyperlink

更新时间:
复制 MD 格式

This topic describes the API operations that are related to hyperlinks in table documents.

Hyperlinks

app.ActiveSheet.Hyperlinks

Important

Only JavaScript SDK V1.1.16 and later support this feature.

Obtains a collection of all hyperlinks in a table document.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks

    expression: an Application object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the Hyperlink objects in the active worksheet.
      const hyperlinks = await app.app.ActiveSheet.Hyperlinks;
    }

Methods

app.ActiveSheet.Hyperlinks.Item()

Important

Only the SDK for JavaScript V1.1.16 and later support this feature.

Obtains a single Hyperlink object.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks.Item(Index)

    expression: an Application object.

  • Parameters

    Parameter

    Type

    Required

    Description

    Index

    number

    Yes

    The index number of the hyperlink. The value starts from 1.

  • Return values

    Returns a Hyperlink object.

  • Example

    //@file=base.Excel
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      // Obtain a single Hyperlink object.
      await app.app.ActiveSheet.Hyperlinks.Item(1);
    }

app.ActiveSheet.Hyperlinks.Delete()

Deletes the Hyperlinks object.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks.Delete()

    expression: an Application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      // Delete the Hyperlinks object.
      await app.ActiveSheet.Hyperlinks.Delete();
    }

Property

app.ActiveSheet.Hyperlinks.Count

Returns the number of Hyperlink objects in the specified collection.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks.Count

    expression: an Application object.

  • Example

    //@file=base.xlsx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain the number of the hyperlinks in the active worksheet.
      await app.app.ActiveSheet.Hyperlinks.Count;
    }

Hyperlink

app.ActiveSheet.Hyperlinks.Item(Index)

Important

Only JavaScript SDK V1.1.16 and later support this feature.

Obtains a single Hyperlink object.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks.Item(Index)

    expression: an Application object.

  • Parameter

    Property

    Data type

    Required

    Description

    Index

    number

    Yes

    The index number of the hyperlink. The value starts from 1.

  • Return values

    Returns a Hyperlink object.

  • Example

    //@file=base.Excel
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      // Obtain a single Hyperlink object.
      await app.app.ActiveSheet.Hyperlinks.Item(1);
    }

Properties

app.ActiveSheet.Hyperlinks.Item(Index).Address

Returns or sets the address of the hyperlink.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks.Item(Index).Address

    expression: an Application object.

  • Example

    //@file=base.xlsx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
        
      // Obtain the hyperlink address.
      const address = await app.app.ActiveSheet.Hyperlinks.Item(1).Address
    }

app.ActiveSheet.Hyperlinks.Item(Index).TextToDisplay

Returns or sets the text of a hyperlink.

  • Syntax

    expression.app.ActiveSheet.Hyperlinks.Item(Index).TextToDisplay

    expression: an Application object.

  • Example

    //@file=base.xlsx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
        
      // Obtain the text of the specified hyperlink.
      const TextToDisplay = await app.app.ActiveSheet.Hyperlinks.Item(1).TextToDisplay
    }