Spread for ASP.NET 11 Product Documentation
ClearFormulas Method (DefaultSheetDataModel)
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : ClearFormulas Method
Row index of start of range to clear
Column index of start of range to clear
Number of rows to clear
Number of columns to clear
Removes all of the formulas from the specified range of cells.
Syntax
'Declaration
 
Public Overridable Sub ClearFormulas( _
   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.ClearFormulas(row, column, rowCount, columnCount)
public virtual void ClearFormulas( 
   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

For a list of the operators and functions you can use in formulas, refer to the Spread for .NET Formula Reference.

Example
This example adds data to the first three columns along with formulas to sum the values. In the click event of a button the formulas are cleared from the cells. Note, however, that the data in the cells that contained the formulas remains.
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

FpSpread1.ActiveSheetView.Cells(5,0).Formula="SUM(A3:A4)"
FpSpread1.ActiveSheetView.Cells(5,1).Formula="SUM(A3:A4)"
FpSpread1.ActiveSheetView.Cells(5,2).Formula="SUM(A3:A4)"
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.ClearFormulas(5,0,1,3)
End Sub
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);
}

FpSpread1.ActiveSheetView.Cells[5,0].Formula="SUM(A3:A4)";
FpSpread1.ActiveSheetView.Cells[5,1].Formula="SUM(A3:A4)";
FpSpread1.ActiveSheetView.Cells[5,2].Formula="SUM(A3:A4)";
}

private void Button1_Click(object sender,System.EventArgs e)
{
FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=(FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
dm.ClearFormulas(5,0,1,3);
}
See Also

Reference

DefaultSheetDataModel Class
DefaultSheetDataModel Members