示例#1
0
        //public void PeriodicCircCheck(SpreadsheetPanel ss)
        //{
        //    HashSet<string> visited = new HashSet<string>();
        //    ISet<String> circular = new HashSet<string>();

        //    foreach (string name in sheet.GetNamesOfAllNonemptyCells())
        //    {
        //        foreach (string cell in sheet.GetDirectDependents(name))
        //        {
        //            if (!visited.Contains(cell))
        //            {
        //                CircularDependencyCheck(cell, cell, visited, circular);
        //            }
        //            circular.Add(cell);
        //        }

        //        foreach (String s in circular)
        //        {
        //            updateCell(s, ss);
        //        }

        //        foreach (string c in circular)
        //        {
        //            sheet.SetCellCircularStatus(c, false);
        //        }
        //    }
        //}



        public void updateCell(string name, SpreadsheetPanel ss)
        {
            int col = name.ElementAt(0) - 65;
            int row = int.Parse(name.Substring(1)) - 1;

            if (sheet.GetCellCircularStatus(name) == true)
            {
                ss.SetValue(col, row, "#REF ");
            }
            if (sheet.GetCellValue(name) is FormulaError err)
            {
                ss.SetValue(col, row, "#REF ");
            }
            //else
            //    ss.SetValue(col, row, sheet.GetCellValue(name) + "");


            //CS 3505 changes ////////////////////////////////////

            if (sheet.GetCellCircularStatus(name) == true)
            {
                ss.SetValue(col, row, "#REF ");
            }
            else if (sheet.GetCellCircularStatus(name) == false)
            {
                ss.SetValue(col, row, sheet.GetCellValue(name) + "");
            }

            //end ////////////////////////////////////////////////
        }