示例#1
0
        /// <summary>
        /// -SERVICE- if both start and end cells are set, we can guess the reading direction
        /// </summary>
        private void setDirection()
        {
            if(startCell==null || endCell==null)
                throw new InvalidOperationException("Both starting and ending cells should be set before determining the direction");

            if (startCell.Row != endCell.Row && startCell.Column != endCell.Column)
                throw new ArgumentException("The starting and the ending cells should be equal in row or column number.");

            int direction = 0;
            direction += Math.Sign(endCell.Column - startCell.Column) * 3;
            direction += Math.Sign(endCell.Row - startCell.Row);

            this.direction = (ExcelReadDirection)direction;

            return;
        }