Пример #1
0
 public object Clone()
 {
     ToxyCell clonedCell = new ToxyCell(this.CellIndex, this.Value);
     clonedCell.Comment = this.Comment;
     clonedCell.Formula = this.Formula;
     return clonedCell;
 }
Пример #2
0
        public object Clone()
        {
            ToxyCell clonedCell = new ToxyCell(this.CellIndex, this.Value);

            clonedCell.Comment = this.Comment;
            clonedCell.Formula = this.Formula;
            return(clonedCell);
        }
Пример #3
0
        ExcelTableTemplate ParseTable(ToxyCell cell)
        {
            if (cell == null || string.IsNullOrEmpty(cell.Value))
            {
                return null;
            }
            var expr = cell.Value;
            if (string.IsNullOrEmpty(expr))
                return null;
            var eachpart = REG_EXPR_BEGINEACH.Match(expr).Groups;
            if (eachpart.Count == 0) return null;

            ExcelTableTemplate token = new ExcelTableTemplate() { RowIndex = _currRowIndex, ColIndex = _currColIndex, BindName = eachpart[0].Value };

            if (eachpart.Count == 1)
            {
                token.ValueName = eachpart[0].Value;
                var valGroup = REG_EXPR_Value.Match(expr).Groups;
                if (valGroup.Count == 0)
                {
                    token.Cells.Add(new ExcelCellTemplate() { RowIndex = _currRowIndex, ColIndex = _currColIndex });
                    _currColIndex++;
                }
                else
                {
                    var row = _currTable.Rows[_currRowIndex];
                    for (; _currColIndex < row.Cells.Count; _currColIndex++)
                    {
                        var celltoken = ParseCell(row.Cells[_currColIndex]);
                        if (celltoken != null)
                            token.Cells.Add(celltoken);
                    }
                }
            }
            return token;
        }
Пример #4
0
        ExcelCellTemplate ParseCell(ToxyCell cell)
        {
            if (cell == null || string.IsNullOrEmpty(cell.Value)) {
                return null;
            }
            var expr = cell.Value;
            if (string.IsNullOrEmpty(expr))
                return null;

            var bindName = string.Empty;
            var valGroup = REG_EXPR_Value.Match(expr).Groups;
            if (valGroup.Count == 1)
            {
                return new ExcelCellTemplate() { RowIndex = _currRowIndex, ColIndex = _currColIndex, BindName = valGroup[0].Value };
            }
            valGroup = REG_EXPR.Match(expr).Groups;
            if (valGroup.Count == 1)
            {
                return new ExcelCellTemplate() { RowIndex = _currRowIndex, ColIndex = _currColIndex, BindName = valGroup[0].Value };
            }
            return null;
        }