Skip to content

Commit c6f163f

Browse files
tomas-sexenianBeta Bot
authored andcommitted
Cherry pick branch 'genexuslabs:cells-link' into beta
1 parent 409df19 commit c6f163f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,39 @@ public void setBackColor(long value) {
766766
}
767767
}
768768

769+
public String getHyperlink() {
770+
try {
771+
Hyperlink link = pCells[1].getHyperlink();
772+
if (link != null) {
773+
return link.getAddress();
774+
}
775+
} catch (Exception e) {
776+
m_errAccess.setErrDes("Invalid cell value");
777+
m_errAccess.setErrCod((short) 7);
778+
}
779+
return "";
780+
}
781+
782+
public void setHyperLink(String value) {
783+
if (readonly) {
784+
m_errAccess.setErrDes("Can not modify a readonly document");
785+
m_errAccess.setErrCod((short) 13);
786+
return;
787+
}
788+
789+
try {
790+
CreationHelper createHelper = pWorkbook.getCreationHelper();
791+
Hyperlink link = createHelper.createHyperlink(org.apache.poi.common.usermodel.HyperlinkType.URL);
792+
link.setAddress(value);
793+
for (int i = 1; i <= cntCells; i++) {
794+
pCells[i].setHyperlink(link);
795+
}
796+
} catch (Exception e) {
797+
m_errAccess.setErrDes("Invalid cell value");
798+
m_errAccess.setErrCod((short) 7);
799+
}
800+
}
801+
769802
protected void copyPropertiesStyle(CellStyle dest, CellStyle source) {
770803
dest.cloneStyleFrom(source);
771804
}

0 commit comments

Comments
 (0)