Skip to content

Commit bc33a6f

Browse files
authored
Merge branch 'master' into CreateFileFromStream
2 parents c61bbd9 + 82ba01e commit bc33a6f

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

common/src/main/java/com/genexus/GXExternalCollection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ public Vector getStruct()
100100
}
101101

102102
@SuppressWarnings("unchecked")
103-
public ArrayList getExternalInstance() {
104-
ArrayList list = new ArrayList();
103+
public <E> ArrayList<E> getExternalInstance() {
104+
ArrayList<E> list = new ArrayList<>();
105105
for (T Item : this)
106106
{
107107
try
108108
{
109-
list.add(Item.getClass().getMethod("getExternalInstance", new Class[]{}).invoke(Item));
109+
list.add((E) Item.getClass().getMethod("getExternalInstance", new Class[]{}).invoke(Item));
110110
}
111111
catch (Exception e)
112112
{

gxoffice/src/main/java/com/genexus/msoffice/excel/IExcelCellRange.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
public interface IExcelCellRange
88
{
9+
String getHyperlinkValue();
10+
11+
Boolean setHyperlinkValue(String value);
12+
913
int getRowStart();
1014

1115
int getRowEnd();

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,55 @@ 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+
760+
@Override
761+
public String getHyperlinkValue() {
762+
try {
763+
return this.getHyperlink();
764+
} catch (ExcelException e) {
765+
_errorHandler.setErrCod((short) e.get_errorCode());
766+
_errorHandler.setErrDes(e.get_errDsc());
767+
}
768+
return "";
769+
}
770+
771+
@Override
772+
public Boolean setHyperlinkValue(String value) {
773+
try {
774+
return this.setHyperlink(value);
775+
} catch (ExcelException e) {
776+
_errorHandler.setErrCod((short) e.get_errorCode());
777+
_errorHandler.setErrDes(e.get_errDsc());
778+
}
779+
return false;
780+
}
781+
733782
protected void copyPropertiesStyle(XSSFCellStyle dest, XSSFCellStyle source) {
734783
dest.cloneStyleFrom(source);
735784
}

0 commit comments

Comments
 (0)