コード例 #1
0
        private bool AreCalculateReferencedCells(BCell par_item)
        {
            bool          result   = true;
            List <string> tmp_list = par_item.ExtractReferencedCells();

            if (tmp_list.Any())
            {
                List <BCell> cells_list = new List <BCell>();
                foreach (var item in tmp_list)
                {
                    cells_list.Add(Table_List.Single(x => x.Address.Equals(item)));
                }


                if (cells_list.Any(x => x.IsCalculated == false))
                {
                    return(false);
                }
                else
                {
                    foreach (var item in cells_list)
                    {
                        par_item.FormulaTemp = par_item.FormulaTemp.Replace("$!?" + item.Address + "?!$", item.Value);
                    }
                }
            }

            return(result);
        }
コード例 #2
0
 public void HiglightCell(BCell Par_BCell, string Par_Color)
 {
     Par_BCell.bStyle = new BStyle()
     {
         BorderColor     = Par_Color,
         BackgroundColor = "yellow",
         ForeColor       = "blue",
         BorderWidth     = 2,
     };
 }
コード例 #3
0
        public void Initialize()
        {
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    Table_List.Add(new BCell()
                    {
                        ID     = Table_List.Count + 1,
                        Row    = i,
                        Column = j,
                    });
                }
            }


            foreach (var item in Table_List)
            {
                item.Initialize();
            }


            BCell b = Table_List.Single(x => x.Row == 1 && x.Column == 0);

            b.Formula = "=25+1";
            b         = Table_List.Single(x => x.Row == 1 && x.Column == 1);
            b.Formula = "=$!?A2?!$+$!?C2?!$";

            b       = Table_List.Single(x => x.Row == 1 && x.Column == 2);
            b.Value = "14";

            b       = Table_List.Single(x => x.Row == 4 && x.Column == 3);
            b.Value = "hello";

            b         = Table_List.Single(x => x.Row == 0 && x.Column == 0);
            b.Formula = "=$!?A2?!$+$!?C2?!$+$!?B2?!$+$!?K10?!$";

            b         = Table_List.Single(x => x.Row == 5 && x.Column == 1);
            b.Formula = "=2.58+2*(125-2)";


            b         = Table_List.Single(x => x.Row == 9 && x.Column == 9);
            b.Formula = "=$!?B2?!$";



            Calculate();
        }