Spread ASP.NET 17
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / FpSpread Class / Reset Method
Example


In This Topic
    Reset Method (FpSpread)
    In This Topic
    Resets the Spread component to its default values, removing all settings and all sheets.
    Syntax
    'Declaration
     
    
    Public Sub Reset() 
    'Usage
     
    
    Dim instance As FpSpread
     
    instance.Reset()
    public void Reset()
    Remarks

    This method returns the component to the state as if the Spread object was just created with the default constructor. That default Spread object has no sheets in the component and no appearance settings set.

    It resets the Sheets and the NamedStyles collections to their default values.

    Caution: If you use the Reset method, everything in your component is deleted, including data, style settings, and sheets.

    Example
    This example creates a spreadsheet with three sheets, changes the name of the sheets, and sets the backcolor of the first cell on each one. In a button click event, the spreadsheet is reset to its original settings.
    private void Page_Load(object sender,System.EventArgs e)
    {
    If(this.IsPostBack) Return;
    
    FpSpread1.Sheets.Count=3;
    FpSpread1.Sheets[0].SheetName="One";
    FpSpread1.Sheets[1].SheetName="Two";
    FpSpread1.Sheets[2].SheetName="Three";
    FpSpread1.Sheets[0].Cells[0,0].BackColor=Color.Yellow;
    FpSpread1.Sheets[1].Cells[0,0].BackColor=Color.Yellow;
    FpSpread1.Sheets[2].Cells[0,0].BackColor=Color.Yellow;
    }
    
    private void Button1_Click(object sender,System.EventArgs e)
    {
    FpSpread1.Reset();
    }
    Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
    
    If(Me.IsPostBack)Then Return
    
    FpSpread1.Sheets.Count=3
    FpSpread1.Sheets(0).SheetName="One"
    FpSpread1.Sheets(1).SheetName="Two"
    FpSpread1.Sheets(2).SheetName="Three"
    FpSpread1.Sheets(0).Cells(0,0).BackColor=Color.Yellow
    FpSpread1.Sheets(1).Cells(0,0).BackColor=Color.Yellow
    FpSpread1.Sheets(2).Cells(0,0).BackColor=Color.Yellow
    End Sub
    
    Private SubButton1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click
    FpSpread1.Reset()
    End Sub
    See Also