diff --git a/gxoffice/src/main/java/com/genexus/msoffice/excel/IExcelCellRange.java b/gxoffice/src/main/java/com/genexus/msoffice/excel/IExcelCellRange.java index bfaf71cca..1d5a3746f 100644 --- a/gxoffice/src/main/java/com/genexus/msoffice/excel/IExcelCellRange.java +++ b/gxoffice/src/main/java/com/genexus/msoffice/excel/IExcelCellRange.java @@ -6,6 +6,10 @@ public interface IExcelCellRange { + String getHyperlinkValue(); + + Boolean setHyperlinkValue(String value); + int getRowStart(); int getRowEnd(); diff --git a/gxoffice/src/main/java/com/genexus/msoffice/excel/poi/xssf/ExcelCells.java b/gxoffice/src/main/java/com/genexus/msoffice/excel/poi/xssf/ExcelCells.java index 4faaf16e1..443c96936 100644 --- a/gxoffice/src/main/java/com/genexus/msoffice/excel/poi/xssf/ExcelCells.java +++ b/gxoffice/src/main/java/com/genexus/msoffice/excel/poi/xssf/ExcelCells.java @@ -730,6 +730,55 @@ public void setColor(long value) throws ExcelException // 05/07/05 B@tero } } + public String getHyperlink() throws ExcelException { + try { + Hyperlink link = pCells[1].getHyperlink(); + if (link != null) { + return link.getAddress(); + } + } catch (Exception e) { + throw new ExcelException(7, "Invalid cell value", e); + } + return ""; + } + + public boolean setHyperlink(String value) throws ExcelException { + CheckReadonlyDocument(); + try { + CreationHelper createHelper = pWorkbook.getCreationHelper(); + Hyperlink link = createHelper.createHyperlink(org.apache.poi.common.usermodel.HyperlinkType.URL); + link.setAddress(value); + for (int i = 1; i <= cellCount; i++) { + pCells[i].setHyperlink(link); + } + return true; + } catch (Exception e) { + throw new ExcelException(7, "Invalid cell value", e); + } + } + + @Override + public String getHyperlinkValue() { + try { + return this.getHyperlink(); + } catch (ExcelException e) { + _errorHandler.setErrCod((short) e.get_errorCode()); + _errorHandler.setErrDes(e.get_errDsc()); + } + return ""; + } + + @Override + public Boolean setHyperlinkValue(String value) { + try { + return this.setHyperlink(value); + } catch (ExcelException e) { + _errorHandler.setErrCod((short) e.get_errorCode()); + _errorHandler.setErrDes(e.get_errDsc()); + } + return false; + } + protected void copyPropertiesStyle(XSSFCellStyle dest, XSSFCellStyle source) { dest.cloneStyleFrom(source); }