Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2335
How to get Cell Object, Row Index or Column Index in ExcelCalcFunction extended Custom Function
posted

Is it possible to get Calling cell information like Cell Object or Row Index and Column Index of Cuntom or User Defined function calling cell in  Evaluate Method?

    public class Function_Factorial : Infragistics.Silverlight.Excel.CalcEngine.ExcelCalcFunction
    {
        public override string Name
        {
            get
            {
                return "factorial";
            }
        }

        protected override ExcelCalcValue Evaluate(ExcelCalcNumberStack numberStack, int argumentCount)
        { 
             // can we get cell row index and column index here?

             return new ExcelCalcValue(this.CalculateFactorial(val));
        }

        private Int64 CalculateFactorial( Int64 value )
        {
            if ( value == 0 )
                return 1;

            if ( value < 3 )
                return value;

            Int64 factorial = 2;

            checked       
            {
                for ( Int64 i = 3; i <= value; i++ )
                {
                    factorial *= i;
                }
            }

            return factorial;
        }
    }

I also posted same question  on following link in SilverLight Section:

http://forums.infragistics.com/forums/t/36403.aspx

Thanks

Parents Reply Children
No Data