Aspose.Cells.GridWeb.Examples.CSharp.Worksheets.ManageComments.btnAddComments_Click C# (CSharp) Method

btnAddComments_Click() protected method

protected btnAddComments_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        protected void btnAddComments_Click(object sender, EventArgs e)
        {
            // ExStart:AddComments
            // Accessing the reference of the worksheet that is currently active and add a dummy value to cell A1
            GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
            sheet.Cells["A1"].PutValue("This cell has a comment added, hover to view.");

            // Resize first column
            sheet.Cells.SetColumnWidth(0, 140);

            // Adding comment to "A1" cell of the worksheet
            GridComment comment = sheet.Comments[sheet.Comments.Add("A1")];

            // Setting the comment note
            comment.Note = "These are my comments for the cell";
            // ExEnd:AddComments
        }