From 7166c9108efa189c956df6253edaf22924f0ada2 Mon Sep 17 00:00:00 2001 From: "tomas.sexenian" Date: Mon, 14 Jul 2025 14:00:16 -0300 Subject: [PATCH 1/5] Implement getHyperlink and setHyperLink to xssf.ExcelCells --- .../genexus/gxoffice/poi/xssf/ExcelCells.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java b/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java index ea811a4d8..372c32f01 100644 --- a/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java +++ b/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java @@ -766,6 +766,39 @@ public void setBackColor(long value) { } } + public String getHyperlink() { + try { + Hyperlink link = pCells[1].getHyperlink(); + if (link != null) { + return link.getAddress(); + } + } catch (Exception e) { + m_errAccess.setErrDes("Invalid cell value"); + m_errAccess.setErrCod((short) 7); + } + return ""; + } + + public void setHyperLink(String value) { + if (readonly) { + m_errAccess.setErrDes("Can not modify a readonly document"); + m_errAccess.setErrCod((short) 13); + return; + } + + try { + CreationHelper createHelper = pWorkbook.getCreationHelper(); + Hyperlink link = createHelper.createHyperlink(org.apache.poi.common.usermodel.HyperlinkType.URL); + link.setAddress(value); + for (int i = 1; i <= cntCells; i++) { + pCells[i].setHyperlink(link); + } + } catch (Exception e) { + m_errAccess.setErrDes("Invalid cell value"); + m_errAccess.setErrCod((short) 7); + } + } + protected void copyPropertiesStyle(CellStyle dest, CellStyle source) { dest.cloneStyleFrom(source); } From 2dc599c517d81c347a94c1d6caf402a9d5aed373 Mon Sep 17 00:00:00 2001 From: "tomas.sexenian" Date: Mon, 14 Jul 2025 15:54:33 -0300 Subject: [PATCH 2/5] Revert "Implement getHyperlink and setHyperLink to xssf.ExcelCells" This reverts commit 7166c9108efa189c956df6253edaf22924f0ada2. --- .../genexus/gxoffice/poi/xssf/ExcelCells.java | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java b/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java index 372c32f01..ea811a4d8 100644 --- a/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java +++ b/gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java @@ -766,39 +766,6 @@ public void setBackColor(long value) { } } - public String getHyperlink() { - try { - Hyperlink link = pCells[1].getHyperlink(); - if (link != null) { - return link.getAddress(); - } - } catch (Exception e) { - m_errAccess.setErrDes("Invalid cell value"); - m_errAccess.setErrCod((short) 7); - } - return ""; - } - - public void setHyperLink(String value) { - if (readonly) { - m_errAccess.setErrDes("Can not modify a readonly document"); - m_errAccess.setErrCod((short) 13); - return; - } - - try { - CreationHelper createHelper = pWorkbook.getCreationHelper(); - Hyperlink link = createHelper.createHyperlink(org.apache.poi.common.usermodel.HyperlinkType.URL); - link.setAddress(value); - for (int i = 1; i <= cntCells; i++) { - pCells[i].setHyperlink(link); - } - } catch (Exception e) { - m_errAccess.setErrDes("Invalid cell value"); - m_errAccess.setErrCod((short) 7); - } - } - protected void copyPropertiesStyle(CellStyle dest, CellStyle source) { dest.cloneStyleFrom(source); } From e67de722af6494622a1c97b3d90e78b3c3a5752f Mon Sep 17 00:00:00 2001 From: "tomas.sexenian" Date: Mon, 14 Jul 2025 15:55:00 -0300 Subject: [PATCH 3/5] Implement getHyperlink and setHyperLink to msoffice xssf.ExcelCells --- .../msoffice/excel/poi/xssf/ExcelCells.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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..90d9d311d 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,33 @@ 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); + } + } + protected void copyPropertiesStyle(XSSFCellStyle dest, XSSFCellStyle source) { dest.cloneStyleFrom(source); } From bb00da7d6f5661126a7b9454325a6907510ea3c4 Mon Sep 17 00:00:00 2001 From: "tomas.sexenian" Date: Mon, 14 Jul 2025 16:15:44 -0300 Subject: [PATCH 4/5] Allign casing --- .../java/com/genexus/msoffice/excel/poi/xssf/ExcelCells.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 90d9d311d..93da0800f 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 @@ -742,7 +742,7 @@ public String getHyperlink() throws ExcelException { return ""; } - public boolean setHyperLink(String value) throws ExcelException { + public boolean setHyperlink(String value) throws ExcelException { CheckReadonlyDocument(); try { CreationHelper createHelper = pWorkbook.getCreationHelper(); From 5c624321cf65ad18f6561f9e63dadc21f375f875 Mon Sep 17 00:00:00 2001 From: "tomas.sexenian" Date: Mon, 14 Jul 2025 16:59:12 -0300 Subject: [PATCH 5/5] Comply with the interface of other msoffice methods --- .../msoffice/excel/IExcelCellRange.java | 4 ++++ .../msoffice/excel/poi/xssf/ExcelCells.java | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) 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 93da0800f..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 @@ -757,6 +757,28 @@ public boolean setHyperlink(String value) throws ExcelException { } } + @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); }