Add Comments in Excel Worksheets using C++

Add Comments in Excel Worksheets using C++

Microsoft Excel provides the option to add comments in Excel files. There can be several reasons for adding comments, such as explaining a formula or adding contextual information that might be useful to the reader. Comments may also be used to suggest edits in the worksheet. Furthermore, you can set the font size, height, width, etc., of the comments. In this article, you will learn how to add comments to Excel worksheets programmatically using C++.

C++ API for Adding Comments in Excel Worksheets

Aspose.Cells for C++ is a native C++ library that allows you to work with Excel files. With the API, you can easily create, read and modify Excel files. Furthermore, you can add comments to your Excel worksheets. To get started, install the API through NuGet or download it directly from the Downloads section.

PM> Install-Package Aspose.Cells.Cpp

Add Comments in an Excel Worksheet using C++

The following are the steps to add a comment to a cell in an Excel worksheet.

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

Image showing the comment added to the cell F5
Image showing the comment added to the cell F5

Apply Formatting to Comments in an Excel Worksheet using C++

The following are the steps to apply formatting to comments in an Excel worksheet using C++.

The following sample code shows how to apply formatting to a comment in an Excel worksheet using C++.

Image showing the comment with custom formatting added to the cell F5
Image showing the comment with custom formatting added to the cell F5

Get a Free License

In order to try the API without evaluation limitations, you can request a free temporary license.

Conclusion

In this article, you have learned how to add comments in an Excel worksheet using C++. Furthermore, you have seen how to apply formatting to comments using the simple to use Aspose.Cells for C++ API. The API provides a bunch of additional features for working with Excel files that you can explore in detail by visiting the official documentation. In case of any questions, please feel free to reach us at our free support forum.

See Also