Skip to content

Commit e67de72

Browse files
Implement getHyperlink and setHyperLink to msoffice xssf.ExcelCells
1 parent 2dc599c commit e67de72

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

gxoffice/src/main/java/com/genexus/msoffice/excel/poi/xssf/ExcelCells.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,33 @@ public void setColor(long value) throws ExcelException // 05/07/05 B@tero
730730
}
731731
}
732732

733+
public String getHyperlink() throws ExcelException {
734+
try {
735+
Hyperlink link = pCells[1].getHyperlink();
736+
if (link != null) {
737+
return link.getAddress();
738+
}
739+
} catch (Exception e) {
740+
throw new ExcelException(7, "Invalid cell value", e);
741+
}
742+
return "";
743+
}
744+
745+
public boolean setHyperLink(String value) throws ExcelException {
746+
CheckReadonlyDocument();
747+
try {
748+
CreationHelper createHelper = pWorkbook.getCreationHelper();
749+
Hyperlink link = createHelper.createHyperlink(org.apache.poi.common.usermodel.HyperlinkType.URL);
750+
link.setAddress(value);
751+
for (int i = 1; i <= cellCount; i++) {
752+
pCells[i].setHyperlink(link);
753+
}
754+
return true;
755+
} catch (Exception e) {
756+
throw new ExcelException(7, "Invalid cell value", e);
757+
}
758+
}
759+
733760
protected void copyPropertiesStyle(XSSFCellStyle dest, XSSFCellStyle source) {
734761
dest.cloneStyleFrom(source);
735762
}

0 commit comments

Comments
 (0)