org.apache.poi.xssf.usermodel

## Class XSSFHyperlink

- java.lang.Object
- - org.apache.poi.xssf.usermodel.XSSFHyperlink

- All Implemented Interfaces:
    Hyperlink

      public class XSSFHyperlink
      extends java.lang.Object
      implements Hyperlink

  XSSF Implementation of a Hyperlink. Note - unlike with HSSF, many kinds of hyperlink are largely stored as relations of the sheet

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `XSSFHyperlink(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink ctHyperlink, PackageRelationship hyperlinkRel)` Create a XSSFHyperlink and initialize it from the supplied CTHyperlink bean and package relationship
    `` | `XSSFHyperlink(Hyperlink other)` Create a new XSSFHyperlink.
    `protected` | `XSSFHyperlink(HyperlinkType type)` Create a new XSSFHyperlink.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `generateRelationIfNeeded(PackagePart sheetPart)` Generates the relation if required
    `java.lang.String` | `getAddress()` Hyperlink address.
    `java.lang.String` | `getCellRef()` Get the address of the cell this hyperlink applies to, e.g.
    `org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink` | `getCTHyperlink()`
    `int` | `getFirstColumn()` Return the column of the first cell that contains the hyperlink
    `int` | `getFirstRow()` Return the row of the first cell that contains the hyperlink
    `java.lang.String` | `getLabel()` Return text label for this hyperlink
    `int` | `getLastColumn()` Return the column of the last cell that contains the hyperlink
    `int` | `getLastRow()` Return the row of the last cell that contains the hyperlink
    `java.lang.String` | `getLocation()` Location within target.
    `java.lang.String` | `getTooltip()`
    `HyperlinkType` | `getType()` Return the type of this hyperlink
    `HyperlinkType` | `getTypeEnum()` Deprecated. use `getType` instead
    `boolean` | `needsRelationToo()` Do we need to a relation too, to represent this hyperlink?
    `void` | `setAddress(java.lang.String address)` Hyperlink address.
    `void` | `setCellReference(CellReference ref)`
    `void` | `setCellReference(java.lang.String ref)` Assigns this hyperlink to the given cell reference
    `void` | `setFirstColumn(int col)` Set the column of the first cell that contains the hyperlink
    `void` | `setFirstRow(int row)` Set the row of the first cell that contains the hyperlink
    `void` | `setLabel(java.lang.String label)` Sets text label for this hyperlink
    `void` | `setLastColumn(int col)` Set the column of the last cell that contains the hyperlink.
    `void` | `setLastRow(int row)` Set the row of the last cell that contains the hyperlink.
    `void` | `setLocation(java.lang.String location)` Location within target.
    `void` | `setTooltip(java.lang.String text)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XSSFHyperlink

          protected XSSFHyperlink(HyperlinkType type)

      Create a new XSSFHyperlink. This method is protected to be used only by `XSSFCreationHelper.createHyperlink(HyperlinkType)`.
      Parameters:
        `type` - - the type of hyperlink to create

    - #### XSSFHyperlink

          protected XSSFHyperlink(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink ctHyperlink,
                                  PackageRelationship hyperlinkRel)

      Create a XSSFHyperlink and initialize it from the supplied CTHyperlink bean and package relationship
      Parameters:
        `ctHyperlink` - the xml bean containing xml properties
        `hyperlinkRel` - the relationship in the underlying OPC package which stores the actual link's address

    - #### XSSFHyperlink

          @Internal
          public XSSFHyperlink(Hyperlink other)

      Create a new XSSFHyperlink. This method is for Internal use only. XSSFHyperlinks can be created by `XSSFCreationHelper`. See the spreadsheet quick-guide for an example.
      Parameters:
        `other` - the hyperlink to copy

  - ### Method Detail

    - #### getCTHyperlink

          @Internal
          public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink getCTHyperlink()

      Returns:
        the underlying CTHyperlink object

    - #### needsRelationToo

          public boolean needsRelationToo()

      Do we need to a relation too, to represent this hyperlink?

    - #### generateRelationIfNeeded

          protected void generateRelationIfNeeded(PackagePart sheetPart)

      Generates the relation if required

    - #### getType

          public HyperlinkType getType()

      Return the type of this hyperlink
      Specified by:
        `getType` in interface `Hyperlink`
      Returns:
        the type of this hyperlink
      See Also:
        `HyperlinkType.forInt(int)`

    - #### getTypeEnum

          @Deprecated
           @Removal(version="4.2")
          public HyperlinkType getTypeEnum()

      Deprecated. use `getType` instead
      Return the type of this hyperlink
      Specified by:
        `getTypeEnum` in interface `Hyperlink`
      Returns:
        the type of this hyperlink

    - #### getCellRef

          public java.lang.String getCellRef()

      Get the address of the cell this hyperlink applies to, e.g. A55

    - #### getAddress

          public java.lang.String getAddress()

      Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file. The is the hyperlink target.
      Specified by:
        `getAddress` in interface `Hyperlink`
      Returns:
        the address of this hyperlink

    - #### getLabel

          public java.lang.String getLabel()

      Return text label for this hyperlink
      Specified by:
        `getLabel` in interface `Hyperlink`
      Returns:
        text to display

    - #### getLocation

          public java.lang.String getLocation()

      Location within target. If target is a workbook (or this workbook) this shall refer to a sheet and cell or a defined name. Can also be an HTML anchor if target is HTML file.
      Returns:
        location

    - #### setLabel

          public void setLabel(java.lang.String label)

      Sets text label for this hyperlink
      Specified by:
        `setLabel` in interface `Hyperlink`
      Parameters:
        `label` - text label for this hyperlink

    - #### setLocation

          public void setLocation(java.lang.String location)

      Location within target. If target is a workbook (or this workbook) this shall refer to a sheet and cell or a defined name. Can also be an HTML anchor if target is HTML file.
      Parameters:
        `location` - - string representing a location of this hyperlink

    - #### setAddress

          public void setAddress(java.lang.String address)

      Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file This is the hyperlink target.
      Specified by:
        `setAddress` in interface `Hyperlink`
      Parameters:
        `address` - - the address of this hyperlink

    - #### setCellReference

          @Internal
          public void setCellReference(java.lang.String ref)

      Assigns this hyperlink to the given cell reference

    - #### setCellReference

          @Internal
          public void setCellReference(CellReference ref)

    - #### getFirstColumn

          public int getFirstColumn()

      Return the column of the first cell that contains the hyperlink
      Returns:
        the 0-based column of the first cell that contains the hyperlink

    - #### getLastColumn

          public int getLastColumn()

      Return the column of the last cell that contains the hyperlink
      Returns:
        the 0-based column of the last cell that contains the hyperlink

    - #### getFirstRow

          public int getFirstRow()

      Return the row of the first cell that contains the hyperlink
      Returns:
        the 0-based row of the cell that contains the hyperlink

    - #### getLastRow

          public int getLastRow()

      Return the row of the last cell that contains the hyperlink
      Returns:
        the 0-based row of the last cell that contains the hyperlink

    - #### setFirstColumn

          public void setFirstColumn(int col)

      Set the column of the first cell that contains the hyperlink
      Parameters:
        `col` - the 0-based column of the first cell that contains the hyperlink

    - #### setLastColumn

          public void setLastColumn(int col)

      Set the column of the last cell that contains the hyperlink. For XSSF, a Hyperlink may only reference one cell
      Parameters:
        `col` - the 0-based column of the last cell that contains the hyperlink

    - #### setFirstRow

          public void setFirstRow(int row)

      Set the row of the first cell that contains the hyperlink
      Parameters:
        `row` - the 0-based row of the first cell that contains the hyperlink

    - #### setLastRow

          public void setLastRow(int row)

      Set the row of the last cell that contains the hyperlink. For XSSF, a Hyperlink may only reference one cell
      Parameters:
        `row` - the 0-based row of the last cell that contains the hyperlink

    - #### getTooltip

          public java.lang.String getTooltip()

      Returns:
        additional text to help the user understand more about the hyperlink

    - #### setTooltip

          public void setTooltip(java.lang.String text)

      Parameters:
        `text` - additional text to help the user understand more about the hyperlink

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.