Custom functions and ReferredAreaCollection

Hi. Can you please fix following issue:


I have some custom function, that retreive as argument some referred area. I should to perform some action with this area, so values of this area are not important. But when i have used INDIRECT function, my function fails.

@Test
public void customFunction() throws Exception {
Workbook workbook = new Workbook(“D://in.xlsx”);

ICustomFunction resolver = new ICustomFunction() {
@Override
public Object calculateCustomFunction(String name, ArrayList params, ArrayList objects) {
if (“CHECKRANGE”.equalsIgnoreCase(name)) {
ReferredAreaCollection refers = (ReferredAreaCollection) objects.get(4);
ReferredArea area = null;
if (refers.getCount() > 0) {
area = refers.get(0);
}
if (area == null) {
System.out.println(“IS NULL”);
} else {
System.out.println(“RIGHT”);
}
}
return null;
}
};

workbook.calculateFormula(true, resolver);
}

Best regards. Alexey

Hi,


Thanks for providing us template file and sample code.

After an initial test, I observed the issue as you mentioned. If we involve some Excel function/ formula (e.g INDIRECT in this case) in the custom function, it fails. It works fine if we do not involve the Excel formula in the custom function though.
e.g
Sample code:



public static void customFunction() throws Exception {
Workbook workbook = new Workbook(“in.xlsx”);


ICustomFunction resolver = new ICustomFunction() {
@Override
public Object calculateCustomFunction(String name, ArrayList params, ArrayList objects) {
if (“CHECKRANGE”.equalsIgnoreCase(name)) {
ReferredAreaCollection refers = (ReferredAreaCollection) objects.get(4);
ReferredArea area = null;
if (refers.getCount() > 0) {
area = refers.get(0);
}
if (area == null) {
System.out.println(“IS NULL”);//prints and fails for “=CHECKRANGE(INDIRECT(C5))” in the template file.
} else {
System.out.println(“RIGHT”);
}
}
return null;
}


};
workbook.calculateFormula(true, resolver);

I have logged a ticket with an id “CELLSJAVA-41345” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells
for Java v8.4.2.5
and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-41345) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.