How to detect any modification in SfSpreadsheet?

Currently, I am using CurrentCellValueChanged to detect cell changes, but actions like inserting or deleting columns, or copying and pasting the entire table cannot be detected.



1 Reply

GS Gokul S Subramani Syncfusion Team September 23, 2024 02:14 PM UTC

Hi Crosslife,


Thank you for reaching out to us. Based on the information you provided, it seems that you want to capture changes when performing clipboard actions or insertion and deletion operations. In our Spreadsheet, we have provided multiple events for the operations listed below. Please review the code snippet below. You can able to perform desired functions with these events.


Code snippet:


private void Spreadsheet_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args)

{

    //Occurs after a range of columns has been inserted.

    spreadsheet.ActiveGrid.Model.ColumnsInserted += Model_ColumnsInserted;

    //Occurs after a range of rows has been inserted.

    spreadsheet.ActiveGrid.Model.RowsInserted += Model_RowsInserted;

    //Occurs when a range of rows is removed.

    spreadsheet.ActiveGrid.Model.RowsRemoved += Model_RowsRemoved;

    //Occurs after a range of columns has been removed.

    spreadsheet.ActiveGrid.Model.ColumnsRemoved += Model_ColumnsRemoved;

    //Occurs when the current cell value gets changed while cell is in edit mode

    spreadsheet.ActiveGrid.CurrentCellValueChanged += ActiveGrid_CurrentCellValueChanged;

    //Occurs after the current cell is validated.

    spreadsheet.ActiveGrid.CurrentCellValidated += ActiveGrid_CurrentCellValidated;

    //Occurs when the value of a cell changes.

    spreadsheet.ActiveSheet.CellValueChanged += ActiveSheet_CellValueChanged;

    //Occurs while copying the content from the Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.

    spreadsheet.CopyPaste.Copying += CopyPaste_Copying;

    //Occurs after copied the content from the Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.

    spreadsheet.CopyPaste.Copied += CopyPaste_Copied;

    //Occurs while pasting the content into Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.

    spreadsheet.CopyPaste.Pasting += CopyPaste_Pasting;

    //Occurs after the content is pasted into Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.

    spreadsheet.CopyPaste.Pasted += CopyPaste_Pasted;

}


We hope this helps to achieve your requirement. Please let us know, if need any further assistance.


Thank you for your understanding and cooperation.


Best Regards,

Gokul S


Loader.
Up arrow icon