Skip to content

Commit ea66833

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

File tree

2 files changed

+27
-33
lines changed

2 files changed

+27
-33
lines changed

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

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -766,39 +766,6 @@ 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-
802769
protected void copyPropertiesStyle(CellStyle dest, CellStyle source) {
803770
dest.cloneStyleFrom(source);
804771
}

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)