FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : Clear Method |
'Declaration Public Sub Clear( _ ByVal row As Integer, _ ByVal column As Integer, _ ByVal rowCount As Integer, _ ByVal columnCount As Integer _ )
'Usage Dim instance As DefaultSheetDataModel Dim row As Integer Dim column As Integer Dim rowCount As Integer Dim columnCount As Integer instance.Clear(row, column, rowCount, columnCount)
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 clears the data, including the formula, the cell note, and the cell tag. Formatting is not handled by the data model, so calling the Clear method in the data model does not clear formatting, including things such as colors.
To clear just the data, and not the formula, cell note, or cell tag, if present, use the ClearData method.
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.Clear(0, 0, 10, 2); }
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.Clear(0, 0, 10, 2) End Sub
Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional