Esempio n. 1
0
        public static Range operator - (Range R, int OffSet)
        {
            OffSet += 1;
            Range rNew = new Range();
            rNew.Left = R.Left; rNew.Right = R.Right;
            rNew.Bottom = R.Top - OffSet;
            rNew.Top = rNew.Bottom - (R.Bottom - R.Top);

            return rNew;
        }
Esempio n. 2
0
        public static Range operator * (Range R, int OffSet)
        {
            OffSet += 1;
            Range rNew = new Range();
            rNew.Top = R.Top; rNew.Bottom = R.Bottom;
            rNew.Left = R.Right + OffSet;
            rNew.Right = rNew.Left + (R.Right - R.Left);

            return rNew;
        }
Esempio n. 3
0
 public static bool IsColShift(Range R1, Range R2)
 {
     if (R1.Right < R2.Left)
     {
         return true;
     }
     else if (R2.Right < R1.Left)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 4
0
 public static bool IsRowShift(Range R1, Range R2)
 {
     if (R1.Bottom > R2.Top)
     {
         return true;
     }
     else if (R2.Bottom > R1.Top)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 5
0
 public static bool IsShift(Range R1, Range R2)
 {
     return Range.IsRowShift(R1, R2) && Range.IsColShift(R1, R2);
 }
Esempio n. 6
0
        public void Clear(Range R)
        {
            this.Cells.Reset();

            this.Cells.EnumerateRange = R;
            IEnumerator<Cell> cells2Clear = this.Cells.GetEnumerator();
            while (cells2Clear.MoveNext())
            {
                cells2Clear.Current.cellHandler.Row.RemoveCell(cells2Clear.Current.cellHandler);
            }

            this.Cells.Reset();
        }
Esempio n. 7
0
 public void Copy(Range srcRange, Cell dstCell)
 {
     
 }
Esempio n. 8
0
        public void Copy(Range srcRange, Range dstRange)
        {
            bool IsRowShift = Range.IsRowShift(srcRange, dstRange);
            bool IsColShift = Range.IsColShift(srcRange, dstRange);

            for (int rowIndex = srcRange.Top; rowIndex <= srcRange.Bottom; rowIndex++)
            {
                int dstRowIndex = rowIndex - srcRange.Top + dstRange.Top;
                IRow srcRow = WorkSheet.GetRow(this.sheetHandler, rowIndex);
                if (srcRow == null)
                {
                    continue;
                }
                IRow dstRow = WorkSheet.GetRow(this.sheetHandler, dstRowIndex, true);
                if (IsRowShift)
                {
                    dstRow.Height = srcRow.Height;
                }

                for (int colIndex = srcRange.Left; colIndex <= srcRange.Right; colIndex++)
                {
                    int dstColIndex = colIndex - srcRange.Left + dstRange.Left;
                    ICell srcCell = srcRow.GetCell(colIndex);
                    ICell dstCell = this.SetValue(srcCell, dstRowIndex, dstColIndex);

                    if (IsColShift)
                    {
                        this.sheetHandler.SetColumnWidth(dstColIndex, this.sheetHandler.GetColumnWidth(colIndex));
                    }
                }
            }
        }