Esempio n. 1
0
 //Записывает в текущую ячейку значение свойства выделенного параметра, field - имя поля
 //Транзакция создается из одной ячейки и добавляется в Transactions
 public void WriteValue(LinkField field, Transaction tlist)
 {
     try
     {
         if (!GeneralRep.CheckOneSheet(true))
         {
             return;
         }
         var v     = CurParam.GetField(field);
         var shape = _book.ActiveShape();
         if (shape == null)
         {
             Range cell = GeneralRep.Application.ActiveCell;
             var   t    = new TransactionCell(cell)
             {
                 NewValue = v,
                 Value    = v
             };
             tlist.AddCell(t);
         }
         else if (shape.Type == MsoShapeType.msoTextBox)
         {
             var t = new TransactionShape(shape)
             {
                 NewValue = v,
                 Value    = v
             };
             tlist.AddShape(t);
         }
     }
     catch {}
 }
Esempio n. 2
0
        //Добавляет примечание comment в ячейку cell
        //tlist - список операций текущей транзакции, если не задан то транзакция создается из одной ячейки и добавляется в Transactions
        private void AddCellLink(string comment, Transaction tlist, Range cell)
        {
            string c = comment;

            if (cell.Comment != null)
            {
                var dicOld = cell.Comment.Text().ToPropertyDictionary();
                var dic    = comment.ToPropertyDictionary();
                if (dic.ContainsKey("NumPoints"))
                {
                    dic.Remove("NumPoints");
                }
                if (dicOld.ContainsKey("NumPoints"))
                {
                    dic.Add("NumPoints", dicOld["NumPoints"]);
                }
                c = dic.ToPropertyString();
            }
            var t = new TransactionCell(cell)
            {
                NewLink = c
            };

            cell.ClearComments();
            cell.AddComment(c);
            tlist.AddCell(t);
            GetCurrentLink(c, cell.Address.Replace("$", ""));
        }
Esempio n. 3
0
        //Добавление ячейки в транзакцию
        public void AddCell(TransactionCell cell)
        {
            string code = cell.Cell.MergeArea.Address.Replace("$", "");
            bool   add  = false;

            if (cell.NewLink != cell.OldLink)
            {
                if (!_cellsLink.ContainsKey(code))
                {
                    _cellsLink.Add(code, cell);
                    Cells.Add(cell);
                    add = true;
                }
                else
                {
                    Repeat.Add(code);
                }
            }
            if (cell.NewValue != cell.OldValue)
            {
                if (!_cellsValue.ContainsKey(code))
                {
                    _cellsValue.Add(code, cell);
                    if (!add)
                    {
                        Cells.Add(cell);
                    }
                }
                else
                {
                    Repeat.Add(code);
                }
            }
        }