This quick tutorial will let you understand all the details about how to remove comment in Excel using Java. It contains the configuration details, a sample code, and a step-by-step guide to remove comments from Excel using Java. You will also learn the process to delete all the comments from a worksheet at once or delete the comments by specifying the target cell reference in different formats and save the output workbook as an XLSX, XLS, or in any of the supported formats.
Steps to Remove Comment in Excel using Java
- Set the reference of Aspose.Cells library from the repository
- Initialize an object of the Workbook class
- Specify the index to access a Worksheet
- Get access to the comments collection in the worksheet
- Remove the comment from the desired cell
- Save output Excel file
These simple steps summarize the whole process to delete comments in Excel using Java. In the first step, you need to access the input file and a worksheet with its index value. Subsequently, delete the comment by accessing it from the Comments collection in the selected worksheet and save the updated Excel file on the disk or stream.
Code to Remove Comments from Excel using Java
The code snippet above uses a few API calls that answer the question about how to remove pop up comments in Excel using Java. Moreover, you can uncomment the line of code to delete all the comments at once. Likewise, you can also choose to delete a comment by specifying its row and column index, or the cell name based on your requirements.
This short tutorial covers the details of different approaches to remove comments from a cell in an Excel file. However, if you want to learn the reverse feature for inserting a comment, head to the article on how to insert comments in Excel using Java.