From f44deb0829e70627691da1e34f1138f695c143be Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 19 Sep 2021 22:38:59 +0000 Subject: [PATCH] make hyperlink duplicatable git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893456 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xssf/usermodel/XSSFHyperlink.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java index 58ccde183e..dca5a130e9 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java @@ -19,6 +19,7 @@ package org.apache.poi.xssf.usermodel; import java.net.URI; import java.net.URISyntaxException; +import org.apache.poi.common.Duplicatable; import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackageRelationship; @@ -34,7 +35,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink; * Note - unlike with HSSF, many kinds of hyperlink * are largely stored as relations of the sheet */ -public class XSSFHyperlink implements Hyperlink { +public class XSSFHyperlink implements Hyperlink, Duplicatable { final private HyperlinkType _type; final private PackageRelationship _externalRel; final private CTHyperlink _ctHyperlink; //contains a reference to the cell where the hyperlink is anchored, getRef() @@ -412,4 +413,13 @@ public class XSSFHyperlink implements Hyperlink { public void setTooltip(String text) { _ctHyperlink.setTooltip(text); } + + /** + * @return a new XSSFHyperlink based on this + * @since POI 5.1.0 + */ + @Override + public Duplicatable copy() { + return new XSSFHyperlink(this); + } }