FlexSheet for WPF | ComponentOne
Working with C1FlexSheet / Cell Operations / Comments
In This Topic
    Comments
    In This Topic

    Comments are inserted in the cells to add some additional information related to the data, and they appear similar to the sticky notes.

    Add Comments

    FlexSheet offers an easy way to add or update a comment in a cell. It allows you to insert comments in a cell without any distortion in the already existing data using InsertComment method of the FlexSheet class, which accepts the cell range where a comment is to be added as its parameter.

    Following lines of code are used to implement InsertComment method in C1FlexSheet:

    If flex.Selection.IsValid AndAlso flex.Selection.IsSingleCell Then
        flex.InsertComment(flex.Selection)
    End If
    
    if (flex.Selection.IsValid && flex.Selection.IsSingleCell)
    {
        flex.InsertComment(flex.Selection);
    }
    
    Back to Top

    Update Comments

    FlexSheet lets you update a comment simply by clicking the comment indicator in a cell which allows you to begin editing. However, you can also update a comment programmatically using UpdateComment method of the FlexSheet class, which accepts the cell range for which the comment is to be updated and the updated comment value as its parameters as illustrated in the following code:

    If flex.Selection.IsValid AndAlso flex.Selection.IsSingleCell Then
        flex.UpdateComment(flex.Selection, "hello")
    End If
    
    if (flex.Selection.IsValid && flex.Selection.IsSingleCell)
    {
            flex.UpdateComment(flex.Selection, "hello");                
    }
    
    Back to Top

    Delete Comments

    FlexSheet allows you to remove an existing comment from a cell using RemoveComment method of the FlexSheet class, which accepts the cell range from which the comment is to be removed as its parameter.

    The following code illustrates the use of the RemoveComment method:

    flex.RemoveComment(flex.Selection)
    
    flex.RemoveComment(flex.Selection);
    
    Back to Top