Example #1
0
        public void InsertIntoLocation(IWorksheet targetWorksheet, int targetRow, int targetColumn,
                                       InsertShiftDirection shiftDirection)
        {
            AssertNotDisposed();
            var targetRange = targetWorksheet.GetRange(targetRow, targetColumn, targetRow + EndRow - StartRow,
                                                       targetColumn + EndColumn - StartColumn) as Range;

            if (targetRange == null)
            {
                throw new InvalidOperationException("Implementation of this method depends on another Office Interop wrapper.");
            }

            Excel.Range _range       = _GetRange();
            Excel.Range _targetRange = targetRange._GetRange();
            lock (Synchronization.ClipboardSyncRoot)
            {
                _targetRange.Insert(EnumConvert.ConvertInsertShiftDirection(shiftDirection), _range.Copy());
            }

            Marshal.ReleaseComObject(_targetRange);
            Marshal.ReleaseComObject(_range);
        }
Example #2
0
 public void InsertIntoLocation(int targetRow, int targetColumn, InsertShiftDirection shiftDirection)
 {
     InsertIntoLocation(Parent, targetRow, targetColumn, shiftDirection);
 }
Example #3
0
 public void InsertIntoLocation(int targetRow, int targetColumn, InsertShiftDirection shiftDirection)
 {
     InsertIntoLocation(Parent, targetRow, targetColumn, shiftDirection);
 }
Example #4
0
        public void InsertIntoLocation(IWorksheet targetWorksheet, int targetRow, int targetColumn,
            InsertShiftDirection shiftDirection)
        {
            AssertNotDisposed();
            var targetRange = targetWorksheet.GetRange(targetRow, targetColumn, targetRow + EndRow - StartRow,
                targetColumn + EndColumn - StartColumn) as Range;
            if (targetRange == null)
            {
                throw new InvalidOperationException("Implementation of this method depends on another Office Interop wrapper.");
            }

            Excel.Range _range = _GetRange();
            Excel.Range _targetRange = targetRange._GetRange();
            lock (Synchronization.ClipboardSyncRoot)
            {
                _targetRange.Insert(EnumConvert.ConvertInsertShiftDirection(shiftDirection), _range.Copy());
            }

            Marshal.ReleaseComObject(_targetRange);
            Marshal.ReleaseComObject(_range);
        }
Example #5
0
 public static Excel.XlInsertShiftDirection ConvertInsertShiftDirection(InsertShiftDirection shiftDirection)
 {
     return(shiftDirection == InsertShiftDirection.ShiftDown
         ? Excel.XlInsertShiftDirection.xlShiftDown
         : Excel.XlInsertShiftDirection.xlShiftToRight);
 }
Example #6
0
 public static Excel.XlInsertShiftDirection ConvertInsertShiftDirection(InsertShiftDirection shiftDirection)
 {
     return shiftDirection == InsertShiftDirection.ShiftDown
         ? Excel.XlInsertShiftDirection.xlShiftDown
         : Excel.XlInsertShiftDirection.xlShiftToRight;
 }