Custom function

2 posts, 0 answers
  1. Predrag
    Predrag avatar
    1 posts
    Member since:
    Aug 2012

    Posted 12 Aug 2013 Link to this post

    HI, is it possible to add custom function in spreadsheet control?
  2. Deyan
    Deyan avatar
    157 posts

    Posted 13 Aug 2013 Link to this post

    Hello Predrag,

    First I'd like to thank you for your interest in RadSpreadsheet!

    It is possible to create custom functions with RadSpreadsheet. Additionally you have great flexibility when handling different cases for the type and count of function arguments, as well as different options for parsing or raising errors on specific argument types. 

    In order to create a custom function you need to inherit from the FunctionBase class or any of its inheritors (NumbersInFunction,  StringsInFunction, BooleansInFunction, etc.) depending on what best suits your needs. By inheriting such a class you need to override the Name and FunctionInfo properties and EvaluateOverride method which returns the result from function calculations.

    Each function may have required arguments and optional arguments (the latter may allow repetitions).

    You may additionally specify concrete argument conversion rules if the default one coming from the inherited class doesn't suit your needs entirely.

    Finally, after you have implemented the new function class, you need to register it using FunctionManager's RegisterFunction method.

    I am sending you a demo project where you can see the implementation of a GeoMean function class, calculating the Geometric mean of a sequence of numbers. You may see function registration in MainWindow constructor which looks like:

    FunctionManager.RegisterFunction(new GeoMean());

    I hope this information is helpful! If you have any other question on a concrete function implementation please do not hesitate to contact us again!

    the Telerik team
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top