CommentCollection.Add
Contents
[
Hide
]Add(int, int)
Adds a comment to the collection.
public int Add(int row, int column)
| Parameter | Type | Description | 
|---|---|---|
| row | Int32 | Cell row index. | 
| column | Int32 | Cell column index. | 
Return Value
Comment object index.
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
    public class CommentCollectionMethodAddWithInt32Int32Demo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            
            CommentCollection comments = worksheet.Comments;
            
            int commentIndex1 = comments.Add(0, 0);
            Comment comment1 = comments[commentIndex1];
            comment1.Note = "First note.";
            comment1.Font.Name = "Times New Roman";
            
            workbook.Save("output.xlsx");
        }
    }
}
See Also
- class CommentCollection
 - namespace Aspose.Cells
 - assembly Aspose.Cells
 
Add(string)
Adds a comment to the collection.
public int Add(string cellName)
| Parameter | Type | Description | 
|---|---|---|
| cellName | String | Cell name. | 
Return Value
Comment object index.
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
    public class CommentCollectionMethodAddWithStringDemo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            CommentCollection comments = worksheet.Comments;
            
            int commentIndex1 = comments.Add("A1");
            Comment comment1 = comments[commentIndex1];
            comment1.Note = "First note.";
            comment1.Font.Name = "Arial";
            
            int commentIndex2 = comments.Add("B2");
            Comment comment2 = comments[commentIndex2];
            comment2.Note = "Second note.";
            comment2.Font.Name = "Times New Roman";
            
            workbook.Save("CommentsDemo.xlsx");
        }
    }
}
See Also
- class CommentCollection
 - namespace Aspose.Cells
 - assembly Aspose.Cells