Пример #1
0
 private Func <Excel.Shape, Excel.Shape, float> GetTestFunc(SequenceDirection direction)
 {
     if (direction == SequenceDirection.TopToBottom)
     {
         return((shape1, shape2) => { return shape1.Top - shape2.Top; });
     }
     else
     {
         return((shape1, shape2) => { return shape1.Left - shape2.Left; });
     }
 }
Пример #2
0
        public void SetSequentialNumber(Excel.ShapeRange shapeRange, uint startNumber, uint step, SequenceDirection direction)
        {
            var testFunc     = GetTestFunc(direction);
            var sortedShapes = Sort(shapeRange, testFunc);

            for (int i = 0; i < sortedShapes.Length; i++)
            {
                sortedShapes[i].TextFrame2.TextRange.Text = string.Format("{0}", startNumber + (step * i));
            }
        }