Free Support Forum -

Excel - Format comments


I have a report that using Aspose.Cells. I want to format comments. I know how the change the text properties, but I want to change the background color and borders (remove borders of the comments.

How can I do that??

Thank you



Yes, you may format comment shapes for your requirements, see the sample code for your reference.

Sample code:
//Instantiate the Workbook
Workbook workbook = new Workbook();
//Get a reference of comments collection with the first sheet
CommentCollection comments = workbook.Worksheets[0].Comments;
//Add a comment to cell A1
int commentIndex = comments.Add(0, 0);
Comment comment = comments[commentIndex];
comment.Note = “First note.”;
comment.Font.Name = “Times New Roman”;
//Load an image into stream
Bitmap bmp = new Bitmap(“e:\test\school.jpg”);
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
//Set image data to the shape associated with the comment
comment.CommentShape.FillFormat.ImageData = ms.ToArray();

commentIndex = comments.Add(2, 1);
Comment comment2 = comments[commentIndex];
comment2.Note = “Second note.”;
//No borders
MsoLineFormat lineFormat = comment2.CommentShape.LineFormat;
lineFormat.ForeColor = Color.Pink;
comment2.CommentShape.FillFormat.ForeColor = Color.Pink;

//Save the workbook

Thank you.