FP.ActiveSheet.Reset() behaviour

Posted by: luigggye-fp on 8 September 2017, 2:24 pm EST

  • Posted 8 September 2017, 2:24 pm EST

    Hi 


    I am sucessfully using the function FP.ActiveSheet.Reset() to reset the sheet to the original state.


    But now, I just want reset the body area (the sheet without the column header area).


    The body area has thousand of rows, for this reason I need a fast way to reset the sheet to the original state without loose the data stored in the column header area.


    Any idea about how to do that quickly?


    Thanks in advance,


    Luigggye


     

  • Replied 8 September 2017, 2:24 pm EST

    Luigggye,


    I didn't find a direct way to reset DataArea of the Spread. However, below code is just a workaround for the same wherein you can call the method to set the ColumnHeader after resetting the Spread.



           private void Form1_Load(object sender, EventArgs e)
            {
                SpreadHeader(); // Setting Spread ColumnHeader using  function
            }
            public void SpreadHeader() // Function to set Spread ColumnHeader 
            {
                // Set the number of rows in the column header.
                fpSpread1.ActiveSheet.ColumnHeader.RowCount = 3;
                // Set the number of columns in the row header.
                fpSpread1.ActiveSheet.RowHeader.ColumnCount = 2;
                // Define the labels for the spanned column header cells.
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 0].Text = "East";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 1].Text = "West";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 2].Text = "East";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 3].Text = "West";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 4].Text = "East";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 5].Text = "West";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 6].Text = "East";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 7].Text = "West";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 0].Text = "1st Quarter";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 2].Text = "2nd Quarter";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 4].Text = "3rd Quarter";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 6].Text = "4th Quarter";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Text = "Fiscal Year 2004";
                // Define the column header cell spans.
                fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 0, 1, 2);
                fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 2, 1, 2);
                fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 4, 1, 2);
                fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 6, 1, 2);
                fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(0, 0, 1, 8);
                // Define the label for the spanned row header cells.
                fpSpread1.ActiveSheet.RowHeader.Cells[0, 0].Text = "Branch #";
                // Define the row header cell span.
                fpSpread1.ActiveSheet.AddRowHeaderSpanCell(0, 0, 12, 1);
            }
            private void btnReset_Click(object sender, EventArgs e)
            {
                fpSpread1.ActiveSheet.Reset();
                SpreadHeader();
            }


    Hope this will help you. Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels