Hi.
Have you changed custom calculation API?
The following test returns different values in params array. Earlier you have returned calculated values of parameters (String or Array of String)
In previous versions of library (e.f. 8.4.2.1), my test returns
MYFUNC(2,7.0,[[Ljava.lang.Object;@6321d94c,)
In current version (8.4.2.5) my test returns
MYFUNC(2,com.aspose.cells.ReferredArea@71c76cf5,com.aspose.cells.ReferredArea@5bc2832e,)
There is test:
@Test
public void calculationOnReferredArea() throws Exception {
Workbook wb = new Workbook(“D://in.xlsx”);
ICustomFunction resolver = new ICustomFunction() {
@Override
public Object calculateCustomFunction(String s, ArrayList arrayList, ArrayList arrayList1) {
StringBuilder sb = new StringBuilder(s);
sb.append("(");
for(Object p : arrayList) {
sb.append§;
sb.append(",");
}
sb.append(")");
return sb.toString();
}
};
wb.calculateFormula(true, resolver);
System.out.println(wb.getWorksheets().get(0).getCells().get(“B2”).getDisplayStringValue());
}
Best regards. Alexey
Hi,
Thanks for providing us template file and sample code.
After an initial test, I observed the issue as you mentioned. I found indifferent returned values of parameters in calculating custom functions. I used the sample code provided by you with your template file. I noticed in previous versions of the library (e.g. 8.4.2.1) the test code returns MYFUNC(2,7.0,[[Ljava.lang.Object;@6321d94c,), whereas in the latest version/fix (v8.4.2.5) the test code returns: MYFUNC(2,com.aspose.cells.ReferredArea@71c76cf5
,com.aspose.cells.ReferredArea@5bc2832e
,)
We will look into it if the newly returned value is fine or we should follow previous approach. I have logged a ticket with an id “CELLSJAVA-41363” for your issue. We will look into it soon.
Once we have any update on it, we will let you know here.
Also keep in mind following my thread:
a array of ContextObjects should contains ReferredArea for second and third parameters.
Best regards. Alexey
Hi.
Ok. So will you not returns an old behavior (when you have returns values of cells in params array)? In this case we will change our code for new implementation behavior of library.
Also, will you implement getValue (or getValues) methods for RefferedArea?
Best regards.
Hi,
Sure, you will use newer approach with the newer versions/ fix, in which we provide those two mentioned methods for ReferredArea.
Thank you.
Will you notify me, when you add new method for RefferedArea?
Best regards.
Hi,
Sure thing! we will notify you in this thread with either attaching the fixed version or sharing download link for the fix when we have fixed the issue.
Thank you.
Hi,
Thanks for using Aspose.Cells.
Please download and try the latest fix: Aspose.Cells
for Java v8.4.2.8 and let us know your feedback.
Now we have added GetValues()/GetValue() methods for ReferredArea class.
Hi. Can you please provide example, when parameter will be instance of RefferedAreaCollection
Best regards. Alexey
Hi Alexey,
Thanks for your posting and using Aspose.Cells.
We have logged your comment in our database against this issue. We will look into it and provide you example. Once, there is some update for you, we will let you know asap.
Hi,
Thanks for using Aspose.Cells.
We do not use ReferredAreaCollection any more. The ReferredArea will be
set as the parameter’s value in “paramsList” when corresponding
parameter is a reference or its calculated result is a reference.
For example, for custom function MYFUNC(A1, 2.0, OFFSET(B1,1,1)), the
objects in paramsList is [ReferredArea(A1), Double(2.0),
ReferredArea(C2)]. User can just get the cell value from the reference
by code:
object p1 = ((ReferredArea)paramsList.get(0)).getValue(0, 0);
object p3 = ((ReferredArea)paramsList.get(2)).getValue(0, 0);
The issues you have found earlier (filed as CELLSJAVA-41363) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.