Spread for ASP.NET 7.0 Product Documentation
ClearData Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : ClearData Method


row
Row index of start of range to clear
column
Column index of start of range to clear
rowCount
Number of rows to clear
columnCount
Number of columns to clear

Glossary Item Box

Removes all the data from the specified range of cells.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub ClearData( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As DefaultSheetDataModel
Dim row As Integer
Dim column As Integer
Dim rowCount As Integer
Dim columnCount As Integer
 
instance.ClearData(row, column, rowCount, columnCount)
C# 
public virtual void ClearData( 
   int row,
   int column,
   int rowCount,
   int columnCount
)

Parameters

row
Row index of start of range to clear
column
Column index of start of range to clear
rowCount
Number of rows to clear
columnCount
Number of columns to clear

Remarks

As an example, suppose you wanted to clear data for the range of cells from B2 to E4. You would set the column and row parameters to 2, the rowCount parameter to 2, and the columnCount parameter to 3.

Clearing data in the data model by calling the ClearData method clears the data, but not the formula, the cell note, or the cell tag. To clear all the data, including the formula, cell note, and cell tag, if present, use the Clear method.

Example

This example adds data to the first three columns. In the click event of a button the data is cleared from the first two columns.
C#Copy Code
private void Page_Load(object sender, System.EventArgs e)
{
    if (this.IsPostBack) return;

    FpSpread1.ActiveSheetView.RowCount = 10;
    for (int i = 0; i<10; 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.ClearData(0, 0, 10, 2);
}
Visual BasicCopy Code
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 9
 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(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.ClearData(0, 0, 10, 2)
End Sub 

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

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