Package org.apache.poi.xssf.usermodel
Class XSSFHyperlink
java.lang.Object
org.apache.poi.xssf.usermodel.XSSFHyperlink
XSSF Implementation of a Hyperlink.
Note - unlike with HSSF, many kinds of hyperlink
are largely stored as relations of the sheet
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedXSSFHyperlink(HyperlinkType type) Create a new XSSFHyperlink.XSSFHyperlink(Hyperlink other) Create a new XSSFHyperlink.protectedXSSFHyperlink(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink ctHyperlink, PackageRelationship hyperlinkRel) Create a XSSFHyperlink and initialize it from the supplied CTHyperlink bean and package relationship -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgenerateRelationIfNeeded(PackagePart sheetPart) Generates the relation if requiredHyperlink address.Get the reference of the cell this applies to, es A55org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlinkintReturn the column of the first cell that contains the hyperlinkintReturn the row of the first cell that contains the hyperlinkgetLabel()Return text label for this hyperlinkintReturn the column of the last cell that contains the hyperlinkintReturn the row of the last cell that contains the hyperlinkLocation within target.getType()Return the type of this hyperlinkDeprecated.booleanDo we need to a relation too, to represent this hyperlink?voidsetAddress(String address) Hyperlink address.voidsetCellReference(String ref) Assigns this hyperlink to the given cell referencevoidvoidsetFirstColumn(int col) Set the column of the first cell that contains the hyperlinkvoidsetFirstRow(int row) Set the row of the first cell that contains the hyperlinkvoidSets text label for this hyperlinkvoidsetLastColumn(int col) Set the column of the last cell that contains the hyperlink.voidsetLastRow(int row) Set the row of the last cell that contains the hyperlink.voidsetLocation(String location) Location within target.voidsetTooltip(String text)
-
Constructor Details
-
XSSFHyperlink
Create a new XSSFHyperlink. This method is protected to be used only byXSSFCreationHelper.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 propertieshyperlinkRel- the relationship in the underlying OPC package which stores the actual link's address
-
XSSFHyperlink
Create a new XSSFHyperlink. This method is for Internal use only. XSSFHyperlinks can be created byXSSFCreationHelper. See the spreadsheet quick-guide for an example.- Parameters:
other- the hyperlink to copy
-
-
Method Details
-
getCTHyperlink
- Returns:
- the underlying CTHyperlink object
-
needsRelationToo
public boolean needsRelationToo()Do we need to a relation too, to represent this hyperlink? -
generateRelationIfNeeded
Generates the relation if required -
getType
Return the type of this hyperlink -
getTypeEnum
Deprecated.usegetTypeinsteadReturn the type of this hyperlink- Specified by:
getTypeEnumin interfaceHyperlink- Returns:
- the type of this hyperlink
-
getCellRef
Get the reference of the cell this applies to, es A55 -
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:
getAddressin interfaceHyperlink- Returns:
- the address of this hyperlink
-
getLabel
Return text label for this hyperlink -
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
Sets text label for this hyperlink -
setLocation
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
Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file This is the hyperlink target.- Specified by:
setAddressin interfaceHyperlink- Parameters:
address- - the address of this hyperlink
-
setCellReference
Assigns this hyperlink to the given cell reference -
setCellReference
-
getFirstColumn
public int getFirstColumn()Return the column of the first cell that contains the hyperlink- Specified by:
getFirstColumnin interfaceHyperlink- 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- Specified by:
getLastColumnin interfaceHyperlink- 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- Specified by:
getFirstRowin interfaceHyperlink- 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- Specified by:
getLastRowin interfaceHyperlink- 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- Specified by:
setFirstColumnin interfaceHyperlink- 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- Specified by:
setLastColumnin interfaceHyperlink- 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- Specified by:
setFirstRowin interfaceHyperlink- 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- Specified by:
setLastRowin interfaceHyperlink- Parameters:
row- the 0-based row of the last cell that contains the hyperlink
-
getTooltip
- Returns:
- additional text to help the user understand more about the hyperlink
-
setTooltip
- Parameters:
text- additional text to help the user understand more about the hyperlink
-
getTypeinstead