示例#1
0
        /// <summary>
        /// Check if all cells references have the same row/col absolute type or if it's mixed
        /// </summary>
        private static Absolute checkAbsolute(ParseTreeNode reference)
        {
            var  cells = ExcelFormulaParser.AllNodes(reference).Where(x => x.Is(GrammarNames.Cell));
            bool first = true;
            var  a     = new Absolute();
            var  locs  = cells.Select(cell => new Location(cell.Print()));

            foreach (var l in locs)
            {
                if (first)
                {
                    a.colAbsolute = l.ColumnFixed;
                    a.rowAbsolute = l.RowFixed;
                    a.mixed       = false;
                    first         = false;
                }
                else
                {
                    if (a.colAbsolute != l.ColumnFixed || a.rowAbsolute != l.RowFixed)
                    {
                        a.mixed = true;
                    }
                }
            }
            return(a);
        }