How to add comment to a word without specifying the comment index?

The background is as follows: I need to add annotations to a bookmark in word. I don’t know how many annotations exist in word. How can I add them without specifying the comment index?
code:
public static void addComment2TableBookMark(Document needAddCommentDoc) throws Exception {
// Create an empty document and DocumentBuilder object.

	DocumentBuilder builder = new DocumentBuilder(needAddCommentDoc);
	String bookMarkName = "PO_RPT_001";
	Bookmark bookMark = needAddCommentDoc.getRange().getBookmarks().get(bookMarkName);
	
	// 创建批注 
	Comment comment = new Comment(needAddCommentDoc, "zz", StringUtils.EMPTY,new Date());
	comment.setText("怎么不能再报表书签上增加批注呢?");
	
	CommentRangeStart start = new CommentRangeStart(needAddCommentDoc,1);
	CommentRangeEnd end = new CommentRangeEnd(needAddCommentDoc,1);

// bookMark.getBookmarkStart().getParentNode().insertBefore(start, bookMark.getBookmarkStart());
// bookMark.getBookmarkStart().getParentNode().insertBefore(comment, bookMark.getBookmarkStart());
// bookMark.getBookmarkEnd().getParentNode().insertAfter(end, bookMark.getBookmarkEnd());
// System.out.println(“1------”);
// System.out.println(bookMark.getBookmarkEnd().getParentNode().getText());
// System.out.println(“2------”);
MergeDocUtil.getLicense();
builder.moveToBookmark(bookMarkName,true,true);
builder.insertNode(comment);
builder.insertNode(start);
builder.write("这是通过后端代码新增的内容 ");

	//builder.write("This is text aftr comment");
	builder.moveTo(bookMark.getBookmarkEnd());
	builder.insertNode(end);
	MergeDocUtil.getLicense();
	needAddCommentDoc.save("D:\\Users\\user001\\Desktop\\reportAddCommenct_2.docx");
	
}

@echozhum,

Thanks for your inquiry. To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input document
  • Aspose.Words 19.10 generated output DOCX file showing the undesired behavior (if any)
  • Your expected DOCX Word document showing the correct output. You can create expected document by using MS Word.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you code to achieve the same output by using Aspose.Words. Thanks for your cooperation.