Example #1
0
        /// <summary>
        /// Recalculates the related cells.
        /// </summary>
        /// <param name="srcCell">The SRC cell.</param>
        private void RecalculateRelatedCells(Cell srcCell)
        {
            RaiseCellValueChanged(srcCell);

            ArrayList changedCells = new ArrayList();

            for (int colIndex = 0; colIndex < this.Columns.Length; colIndex++)
            {
                for (int rowIndex = 0; rowIndex < this.Rows.Length; rowIndex++)
                {
                    Cell cell = this.GetCell(colIndex, rowIndex);

                    if (cell != null && cell.Type == CellType.AutoCalc)
                    {
                        //ExpressionInfo expInfo = ExpressionInfo.Parse(cell.Expression);
                        ExpressionInfo expInfo = cell.GetExpressionInfo();

                        if (expInfo.ContainsParam(srcCell.Uid))
                        {
                            double oldValue = cell.Value;
                            EvaluateAutoValue(cell);

                            changedCells.Add(cell);
                        }
//
//						int index = cell.Expression.IndexOf(srcCell.Uid);
//						if(index!=-1)
//						{
//							char endChar = cell.Expression[index+srcCell.Uid.Length];
//							if(endChar==',' || endChar==')' )
//							{
//								double oldValue = cell.Value;
//								EvaluateAutoValue(cell);
//
//								//if(oldValue!=cell.Value)
//								changedCells.Add(cell);
//							}
//						}
                    }
                }
            }

            foreach (Cell chCell in changedCells)
            {
                RecalculateRelatedCells(chCell);
            }
        }
Example #2
0
        /// <summary>
        /// Parses the specified expression.
        /// </summary>
        /// <param name="Expression">The expression.</param>
        /// <returns></returns>
        public static ExpressionInfo Parse(string Expression)
        {
            if(Expression==string.Empty)
                return ExpressionInfo.Empty;

            ExpressionInfo retVal = new ExpressionInfo();

            //Regex regex = new Regex(@"\[(?<CellUid>[^\]]+)]", RegexOptions.Compiled);

            ArrayList arrParams = new ArrayList();

            foreach (Match match in Regex.Matches(Expression, @"\[(?<CellUid>[^\]]+)]", RegexOptions.Compiled))
            {
                string strCellUid = match.Groups["CellUid"].Value;
                retVal._params.Add(strCellUid);
            }

            return retVal;
        }
Example #3
0
        /// <summary>
        /// Parses the specified expression.
        /// </summary>
        /// <param name="Expression">The expression.</param>
        /// <returns></returns>
        public static ExpressionInfo Parse(string Expression)
        {
            if (Expression == string.Empty)
            {
                return(ExpressionInfo.Empty);
            }

            ExpressionInfo retVal = new ExpressionInfo();

            //Regex regex = new Regex(@"\[(?<CellUid>[^\]]+)]", RegexOptions.Compiled);

            ArrayList arrParams = new ArrayList();

            foreach (Match match in Regex.Matches(Expression, @"\[(?<CellUid>[^\]]+)]", RegexOptions.Compiled))
            {
                string strCellUid = match.Groups["CellUid"].Value;
                retVal._params.Add(strCellUid);
            }

            return(retVal);
        }
Example #4
0
File: Cell.cs Project: 0anion0/IBN
        public ExpressionInfo GetExpressionInfo()
        {
            if (_expressionInfo == null)
                _expressionInfo = ExpressionInfo.Parse(this.Expression);

            return _expressionInfo;
        }