Esempio n. 1
0
        /// <summary>
        /// Переместить курсор с возможностью выделения
        /// </summary>
        /// <param name="application">Приложение</param>
        /// <param name="_units">Тип элементов смещения</param>
        /// <param name="_count">Количество элементов смещения</param>
        /// <param name="direction">Направление смещения</param>
        /// <param name="select">Требуется ли выделять</param>
        static void MoveSelect(Word.Application application, Word.WdUnits _units, int _count, MoveDirection direction, bool select)
        {
            object unit   = _units;
            object count  = _count;
            object extend = select?Word.WdMovementType.wdExtend:Word.WdMovementType.wdMove;

            switch (direction)
            {
            case MoveDirection.Down:
                application.Selection.MoveDown(ref unit, ref count, ref extend);
                break;

            case MoveDirection.Up:
                application.Selection.MoveUp(ref unit, ref count, ref extend);
                break;

            case MoveDirection.Left:
                application.Selection.MoveLeft(ref unit, ref count, ref extend);
                break;

            case MoveDirection.Right:
                application.Selection.MoveRight(ref unit, ref count, ref extend);
                break;
            }
        }
Esempio n. 2
0
        private void MoveSelectionLeft(Word.Selection sel, Word.WdUnits unit, object amount = null)
        {
            if (amount == null)
            {
                amount = 1;
            }

            object extend            = Word.WdMovementType.wdMove;
            object collapseDirection = Word.WdCollapseDirection.wdCollapseEnd;
            object moveUnit          = unit as object;

            sel.MoveLeft(ref moveUnit, ref amount, ref extend);
        }
Esempio n. 3
0
        public void MoveDown(Word.WdUnits unit = Word.WdUnits.wdCharacter, int count = 1, int extend_flag = 0)
        {
            object extend;

            if (extend_flag == 1)
            {
                extend = Word.WdMovementType.wdExtend;
            }
            else
            {
                extend = missing;
            }
            wordApp.Selection.MoveDown(unit, count, extend);
        }