FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : Copy Method |
'Declaration Public Sub Copy( _ ByVal fromRow As Integer, _ ByVal fromColumn As Integer, _ ByVal toRow As Integer, _ ByVal toColumn As Integer, _ ByVal rowCount As Integer, _ ByVal columnCount As Integer _ )
Exception | Description |
---|---|
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 |
This method copies the data in a block 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 copied cells' contents.
Caution: Copying a range of cells pastes them over existing cells. You might want to caution users and have them verify a copy command before overwriting their existing data.
Copying data in the data model copies the data, including the formula, the cell note, and the cell tag. Formatting is not handled by the data model, so calling the Copy method in the data model does not copy formatting, including things such as colors.
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load If(Me.IsPostBack)Then Return FpSpread1.ActiveSheetView.RowCount=10 Dim i As Integer For i=0 To 3 FpSpread1.ActiveSheetView.SetValue(i,0,i) FpSpread1.ActiveSheetView.SetValue(i,1,i) FpSpread1.ActiveSheetView.SetValue(i,2,i) Next End Sub Private Sub Button1_Click(ByValsender 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.Copy(0,0,5,1,3,2) End Sub
private void Page_Load(object sender,System.EventArgs e) { if(this.IsPostBack)return; FpSpread1.ActiveSheetView.RowCount=10; for(int i=0;i<4;i++) { FpSpread1.ActiveSheetView.SetValue(i,0,i); FpSpread1.ActiveSheetView.SetValue(i,1,i); FpSpread1.ActiveSheetView.SetValue(i,2,i); } } private void Button1_Click(object sender,System.EventArgs e) { FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=(FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel; dm.Copy(0,0,5,1,3,2); }
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