# Adding a Comment to a Cell (WPF)

## Content



To add a comment to a cell, complete the following steps:

1.  Add a reference to C1.WPF.Excel.dll and create a **C1XLBook**.
    
    <`// Create a new workbook` `C1XLBook book = new C1XLBook();`
    
2.  Add text to a cell in the worksheet using the following code:
    
    `book.Sheets[0][2, 3].Value = "test";`
    
3.  Add a comment to the [XLCommentCollection](/componentone/api/wpf/online-excel/dotnet-framework-api/C1.WPF.Excel.4.6.2/C1.WPF.Excel.XLCommentCollection.html) and create a box to show it in using the following code:
    
    `book.Sheets[0].Comments.Add(2, 3, "John", "Test comment");<br />         book.Sheets[0].Comments[0].TextBox.Rectangle = new Rect(220, 210, 1900, 1200);`
    
4.  Save and open the book:
    
    ```csharp
    // Save and open the file
     book.Save(@"C:\test.xlsx");
     System.Diagnostics.Process.Start(@"C:\test.xlsx");
    ```
    
5.  Run the program. The spreadsheet will open and look similar to the following:
    
    ![Add Comment](https://cdn.mescius.io/document-site-files/images/4e8fb55a-cee4-4e5b-a6f1-f4ba4ccbfde1/c1excel_graphics/image11_8.png)