This article guides on how to add threaded comments in Excel using Java. It has details to set the IDE, a list of steps, and a sample code to work with the Excel threaded comment using Java. You will learn to create a workbook, an author for a comment, and a new threaded comment in the Excel file.
Steps to Insert Comment in Excel using Java
- Set the IDE to use Aspose.Cells for Java to create threaded comments
- Import the necessary classes and modules from the library
- Load the license to avoid a watermark in the output Excel file
- Create a Workbook and access its first sheet
- Access the target cell from the selected sheet and put some sample value in it
- Get the authors’ collection from the workbook and add a new author to it
- Get the collection of comments for the sheet and add a new comment using the selected author
- Save the workbook with a new threaded comment in it
The above steps describe the process for inserting a comment in Excel sheet using Java. Load a license, create a Workbook, access a sheet in it, select a cell, and enter a sample value in it. Create an author for the comment, add a new comment by linking the above-mentioned author with it, and save the workbook as an Excel file having new threaded comment.
Code to Add Comment in Excel using Java
The aforementioned sample code demonstrates the process to work with the threaded Excel comments using Java. You can set the threaded comment creation time and flag to show/hide the threaded comment. You can also select the parent thread for adding replies using the ParentComment for a threaded comment.
This article has taught us the process to add threaded comment in an Excel file. To merge multiple Excel files, refer to the article Merge Excel Files using Java.