Пример #1
0
        public void ShouldSetExcelState()
        {
            var arg = new FunctionArgument(2);

            arg.SetExcelStateFlag(ExcelCellState.HiddenCell);
            Assert.IsTrue(arg.ExcelStateFlagIsSet(ExcelCellState.HiddenCell));
        }
Пример #2
0
        public override CompileResult Compile(IEnumerable <Expression> children, ParsingContext context)
        {
            var args = new List <FunctionArgument>();

            base.Function.BeforeInvoke(context);
            foreach (var child in children)
            {
                if (base.Function.ResolveArgumentsAsRange)
                {
                    base.ConfigureExcelAddressExpressionToResolveAsRange(child.Children);
                }
                var compileResult = child.Compile();
                if (compileResult.IsResultOfSubtotal)
                {
                    var arg = new FunctionArgument(compileResult.Result);
                    arg.SetExcelStateFlag(ExcelCellState.IsResultOfSubtotal);
                    args.Add(arg);
                }
                else
                {
                    base.BuildFunctionArguments(compileResult.Result, compileResult.DataType, args);
                }
            }
            return(base.Function.Execute(args, context));
        }
Пример #3
0
 protected void BuildFunctionArguments(CompileResult compileResult, DataType dataType, List <FunctionArgument> args)
 {
     if (compileResult.Result is IEnumerable <object> && !(compileResult.Result is ExcelDataProvider.IRangeInfo))
     {
         var compileResultFactory = new CompileResultFactory();
         var argList = new List <FunctionArgument>();
         var objects = compileResult.Result as IEnumerable <object>;
         foreach (var arg in objects)
         {
             var cr = compileResultFactory.Create(arg);
             BuildFunctionArguments(cr, dataType, argList);
         }
         args.Add(new FunctionArgument(argList));
     }
     else
     {
         var funcArg = new FunctionArgument(compileResult.Result, dataType);
         funcArg.ExcelAddressReferenceId = compileResult.ExcelAddressReferenceId;
         if (compileResult.IsHiddenCell)
         {
             funcArg.SetExcelStateFlag(Excel.ExcelCellState.HiddenCell);
         }
         args.Add(funcArg);
     }
 }
Пример #4
0
 public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
 {
     var args = new List<FunctionArgument>();
     Function.BeforeInvoke(context);
     foreach (var child in children)
     {
         var compileResult = child.Compile();
         if (compileResult.IsResultOfSubtotal)
         {
             var arg = new FunctionArgument(compileResult.Result);
             arg.SetExcelStateFlag(ExcelCellState.IsResultOfSubtotal);
             args.Add(arg);
         }
         else
         {
             BuildFunctionArguments(compileResult.Result, args);
         }
     }
     return Function.Execute(args, context);
 }