Add Comments in Excel Worksheets using C#

Add Comments in Excel Worksheet C#

Comments in Excel worksheets are used to add additional information or to explain a formula. These comments can be formatted as well by defining the font size, height, width, etc. In this article, you will learn how to add comments to the Excel worksheets using C#. Furthermore, the article will also demonstrate how to apply formatting and add images to the comments programmatically.

C# API to Add Comments in Excel

In order to add comments in Excel worksheets, we will use Aspose.Cells for .NET. It is a powerful spreadsheet manipulation API that lets you create Excel files from scratch. Also, it supports modifying and converting existing Excel files seamlessly. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Cells

Add Comments to an Excel Worksheet in C#

The following are the steps to add comments to an Excel worksheet in C#.

The following code sample shows how to add a comment in an Excel worksheet using C#.

Add Image to a Comment in Excel using C#

You can also add an image to the comment in the Excel worksheet following the below steps.

The following code sample shows how to add image to a comment in Excel using C#.

Apply Formatting to Comments in Excel using C#

The following are the steps to apply formatting to the comments in Excel using C#.

The following code sample shows how to set formatting of the comments in Excel using C#.

Get a Free License

You can use Aspose.Cells for .NET without evaluation limitations using a temporary license.

Conclusion

In this article, you have learned how to add comments to Excel worksheets using C#. Furthermore, you have seen how to add image to a comment programmatically. You can easily integrate the provided code within your .NET, .NET Core, or Xamarin based applications. In addition, you can explore the documentation of Aspose.Cells for .NET. In case you would have any queries, feel free to post to our forum.

See Also