Spread for ASP.NET 8.0 Product Documentation
Move Method (DefaultSheetDataModel)
Example 


Row index of starting position of range to move
Column index of starting position of range to move
Row index of starting position of destination
Column index of starting position of destination
Number of rows in range
Number of columns in range
Moves the data from a range of cells to the specified location.
Syntax
'Declaration
 
Public Sub Move( _
   ByVal fromRow As Integer, _
   ByVal fromColumn As Integer, _
   ByVal toRow As Integer, _
   ByVal toColumn As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer _
) 
'Usage
 
Dim instance As DefaultSheetDataModel
Dim fromRow As Integer
Dim fromColumn As Integer
Dim toRow As Integer
Dim toColumn As Integer
Dim rowCount As Integer
Dim columnCount As Integer
 
instance.Move(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount)
public void Move( 
   int fromRow,
   int fromColumn,
   int toRow,
   int toColumn,
   int rowCount,
   int columnCount
)

Parameters

fromRow
Row index of starting position of range to move
fromColumn
Column index of starting position of range to move
toRow
Row index of starting position of destination
toColumn
Column index of starting position of destination
rowCount
Number of rows in range
columnCount
Number of columns in range
Exceptions
ExceptionDescription
System.ArgumentException Specified starting and ending row or row count is not valid
System.ArgumentException Specified starting and ending column or column count is not valid
Remarks

This method moves the data of the range of cells.

The destination column and row indicate the upper left cell of the destination block. The contents of the destination block cells are replaced by the moved cells' contents.

Caution: Moving a range of cells pastes them over existing cells. You might want to caution users and have them verify a move command before overwriting their existing data.

Example
This example adds data to two cells and then in the click event of a button moves the data to different cells.
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load

If(Me.IsPostBack)Then Return

FpSpread1.ActiveSheetView.DataModel.SetValue(0,0,"FarPoint")
FpSpread1.ActiveSheetView.DataModel.SetValue(0,1,"Technologies")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click
Dim dm As FarPoint.Web.Spread.Model.DefaultSheetDataModel=CType(FpSpread1.ActiveSheetView.DataModel,FarPoint.Web.Spread.Model.DefaultSheetDataModel)
dm.Move(0,0,2,2,1,2)
End Sub
private void Page_Load(object sender,System.EventArgs e)
{
if(this.IsPostBack)return;

FpSpread1.ActiveSheetView.DataModel.SetValue(0,0,"FarPoint");
FpSpread1.ActiveSheetView.DataModel.SetValue(0,1,"Technologies");
}

private void Button1_Click(object sender,System.EventArgs e)
{
FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=(FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
dm.Move(0,0,2,2,1,2);
}
Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

DefaultSheetDataModel Class
DefaultSheetDataModel Members
Clear Method
Copy Method
RemoveColumn Method
RemoveColumns Method
RemoveRow Method
RemoveRows Method
Swap Method

 

 


Copyright © GrapeCity, inc. All rights reserved.