Add Comments in Excel Worksheets using Java

Add Comments in Excel Worksheet Java

Comments are used to add additional information or to explain a formula in the Excel worksheet. MS Excel also allows you to set the font size, height, width, etc. of the comments. In this article, you will learn how to add comments to the Excel worksheets programmatically using Java. Furthermore, the article will also cover how to format the comments.

Java API to Add Comments in Excel

In order to add comments to the cells in Excel worksheets, we will use Aspose.Cells for Java. The API lets you create, modify, and convert Excel files from within your Java applications. You can either download the API or install it using the following Maven configurations.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-cells</artifactId>
    <version>21.7</version>
</dependency>

Add Comments to an Excel Worksheet in Java

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

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

Apply Formatting to Comments in Excel

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

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

Get a Free License

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

Conclusion

In this article, you have learned how to add comments to the cells in Excel worksheets using Java. Furthermore, you have seen how to apply formatting to the comments programmatically. You can visit the documentation to explore other features of Aspose.Cells for Java. In case you would have any queries, feel free to post to our forum.

See Also