diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java index 31b6d0d9d5..d0259c6805 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -1114,7 +1114,12 @@ public class HSSFCell extends CellBase { return; } - HSSFHyperlink link = (HSSFHyperlink)hyperlink; + HSSFHyperlink link; + if (hyperlink instanceof HSSFHyperlink) { + link = (HSSFHyperlink)hyperlink; + } else { + link = new HSSFHyperlink(hyperlink); + } link.setFirstRow(_record.getRow()); link.setLastRow(_record.getRow());