Spread Windows Forms 6.0 Product Documentation
MoveRange Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class : MoveRange Method


fromRow
Row index of top-left cell in block to move
fromColumn
Column index of top-left cell in block to move
toRow
Row index for destination of upper-left cell in block
toColumn
Column index for destination of upper-left cell in block
rowCount
Number of rows in the block
columnCount
Number of columns in the block
dataOnly
Whether data only or data with formatting are swapped

Glossary Item Box

Moves the data, formatting, formulas, and notes from a block of cells on this sheet to a new location.

Syntax

Visual Basic (Declaration) 
Public Sub MoveRange( _
   ByVal fromRow As Integer, _
   ByVal fromColumn As Integer, _
   ByVal toRow As Integer, _
   ByVal toColumn As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer, _
   ByVal dataOnly As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As SheetView
Dim fromRow As Integer
Dim fromColumn As Integer
Dim toRow As Integer
Dim toColumn As Integer
Dim rowCount As Integer
Dim columnCount As Integer
Dim dataOnly As Boolean
 
instance.MoveRange(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount, dataOnly)
C# 
public void MoveRange( 
   int fromRow,
   int fromColumn,
   int toRow,
   int toColumn,
   int rowCount,
   int columnCount,
   bool dataOnly
)

Parameters

fromRow
Row index of top-left cell in block to move
fromColumn
Column index of top-left cell in block to move
toRow
Row index for destination of upper-left cell in block
toColumn
Column index for destination of upper-left cell in block
rowCount
Number of rows in the block
columnCount
Number of columns in the block
dataOnly
Whether data only or data with formatting are swapped

Exceptions

ExceptionDescription
System.InvalidOperationException Operation is not valid; cannot move entire sheet of cells
System.InvalidOperationException Operation is not valid; cannot move entire columns over partial columns
System.InvalidOperationException Operation is not valid; cannot move entire rows over partial columns
System.InvalidOperationException Operation is not valid; cannot move a range of cells over part of a spanned cell

Remarks

You can use the MoveRange method in the SheetView class to accomplish a shift of cells to the left or right, up or down, as in Excel.
Or you can set the AllowDragDrop property to true to allow the end user to move a cell or range of cells.

Example

This example moves a range of data from one location in the active sheet to another.
C#Copy Code
fpSpread1.ActiveSheet.Cells[0, 0, 2, 2].Text = "Test Move";
fpSpread1.ActiveSheet.MoveRange(0, 0, 4, 0, 2, 2, true);
Visual BasicCopy Code
FpSpread1.ActiveSheet.Cells(0, 0, 2, 2).Text = "Test Move"
FpSpread1.ActiveSheet.MoveRange(0, 0, 4, 0, 2, 2, True)

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.