Last active
February 15, 2026 06:04
-
-
Save aspose-com-kb/8c4312591b9d21eb5694647bfc66074b to your computer and use it in GitHub Desktop.
Add Threaded Comments in Excel using Java. For details: https://kb.aspose.com/cells/java/add-threaded-comments-in-excel-using-java/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.aspose.cells.*; | |
| public class ThreadedCommentsDemo { | |
| public static void main(String[] args) throws Exception { | |
| // Apply Aspose.Cells license | |
| License license = new License(); | |
| license.setLicense("license.lic"); | |
| // Create a workbook and get the first worksheet | |
| Workbook workbook = new Workbook(); | |
| Worksheet sheet = workbook.getWorksheets().get(0); | |
| // Add a value to cell A1 | |
| sheet.getCells().get("A1").putValue("Hello"); | |
| // Create an author for threaded comments | |
| int authorIndex = workbook.getWorksheets() | |
| .getThreadedCommentAuthors() | |
| .add("Aspose Test", "", ""); | |
| ThreadedCommentAuthor author = | |
| workbook.getWorksheets() | |
| .getThreadedCommentAuthors() | |
| .get(authorIndex); | |
| // Add a threaded comment to cell A1 | |
| sheet.getComments() | |
| .addThreadedComment("A1", "Test Threaded Comment", author); | |
| // Save the Excel file | |
| workbook.save("AddThreadedComments_out.xlsx"); | |
| System.out.println("Threaded comment added successfully."); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment