Beispiel #1
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfExcel excel = args[0] as SfExcel;

            Utils.CheckNotNull(excel, m_name);

            Variable sheet = Utils.GetSafeVariable(args, 1);

            if (sheet.Type == Variable.VarType.NUMBER)
            {
                int index = sheet.AsInt();
                excel.ActivateWorksheet(index);
            }
            else
            {
                string name = sheet.AsString();
                excel.ActivateWorksheet(name);
            }

            ParserFunction.UpdateFunction(excel);
            return(excel);
        }
Beispiel #2
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            int numberSheets = Utils.GetSafeInt(args, 0, 1);

            SfExcel excel = new SfExcel(numberSheets);

            return(excel);
        }
Beispiel #3
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 1, m_name);

            string filename = Utils.GetSafeString(args, 0);

            SfExcel excel = new SfExcel();

            excel.Open(filename);

            return(excel);
        }
Beispiel #4
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfExcel excel = args[0] as SfExcel;

            Utils.CheckNotNull(excel, m_name);

            string sheetName = Utils.GetSafeString(args, 1);

            excel.SetWorksheetName(sheetName);

            ParserFunction.UpdateFunction(excel);
            return(excel);
        }
Beispiel #5
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 3, m_name);

            SfExcel excel = args[0] as SfExcel;

            Utils.CheckNotNull(excel, m_name);

            string cell   = Utils.GetSafeString(args, 1);
            string option = Utils.GetSafeString(args, 2);
            string value  = Utils.GetSafeString(args, 3, "");

            excel.SetValue(cell, option, value);

            ParserFunction.UpdateFunction(excel);
            return(excel);
        }
Beispiel #6
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 3, m_name);

            SfExcel excel = args[0] as SfExcel;

            Utils.CheckNotNull(excel, m_name);

            string range  = Utils.GetSafeString(args, 1);
            string title  = Utils.GetSafeString(args, 2);
            int    top    = Utils.GetSafeInt(args, 3);
            int    bottom = Utils.GetSafeInt(args, 4);
            int    left   = Utils.GetSafeInt(args, 5);
            int    right  = Utils.GetSafeInt(args, 6);

            excel.AddChart(range, title, top, bottom, left, right);

            ParserFunction.UpdateFunction(excel);
            return(excel);
        }
Beispiel #7
0
        public override Variable Clone()
        {
            SfExcel newVar = (SfExcel)this.MemberwiseClone();

            return(newVar);
        }