Sign In  Sign Up Live-Chat

ICustomFunction doesn't Override existing Excel Functions

Last post 07-04-2008, 5:06 AM by Amjad Sahi. 2 replies.
Sort Posts: Previous Next
  •  07-03-2008, 1:10 PM 134228

    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
     
  •  07-03-2008, 1:28 PM 134231 in reply to 134228

    Re: ICustomFunction doesn't Override existing Excel Functions

    Hi Stephen,

    Thanks for providing us details,

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

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  07-04-2008, 5:06 AM 134325 in reply to 134231

    Re: ICustomFunction doesn't Override existing Excel Functions

    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 @: http://www.aspose.com/community/forums/thread/134097/support-for-replace-function-in-.net.aspx

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
View as RSS news feed in XML