We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ICustomFunction doesn't Override existing Excel Functions

Hi,



Since the SUBTOTAL function is not supported by Aspose.Cells, I would like to extend the calculation engine to support this function.



I have added my own implementation of the ICustomFunction interface:



internal class MyCustomFunction : ICustomFunction

{

public object CalculateCustomFunction(string functionName, ArrayList paramsList, ArrayList contextObjects)

{

if (functionName == “SUBTOTAL”)

{

return 9999;

}

}

}



However when we run CalculateFormula(), Aspose.Cells still throws an exception for a non-supported function. When we’ve tried renaming the function say to “SUBTOTAL2” in both the code and the spreadsheet, this problem goes away.



Does this mean Aspose.Cells will attempt to execute the existing calculation engine before executing CalculateCustomFunction()?



Would it be possible for Aspose.Cells to change CalculateFormula() so that it executes CalculateCustomFunction() before it’s own calculation engine?



If changing this method is not possible … it’ll be nice to have an overload for CalculateFormula() that allows the API developer to choose whether existing Excel functions are overridable or not.



Thanks,



Stephen Tung

Software Developer

Clarity Systems

Hi Stephen,

Thanks for providing us details,

We will look into it and get back to you soon.

Thank you.

Hi Stephen,

We have supported it. You can calculate the Subtotal function through custom calculation implementing ICustomFunction interface. Kindly try the Aspose.Cells version 4.5.0.3 posted @: <A href="https://forum.aspose.com/t/88644</A></P> <P>Thank you.</P>