// Create and add a Comments Part
CommentsPart cp = new CommentsPart();
wordMLPackage.getMainDocumentPart().addTargetPart(cp);
// Part must have minimal contents
Comments comments = factory.createComments();
cp.setJaxbElement(comments);
// Add a comment to the comments part
java.math.BigInteger commentId = BigInteger.valueOf(0);
Comment theComment = createComment(commentId, "fred", null,
"my first comment");
comments.getComment().add(theComment);
// Add comment reference to document
P paraToCommentOn = wordMLPackage.getMainDocumentPart()
.addParagraphOfText("here is some content");
paraToCommentOn.getContent().add(createRunCommentReference(commentId));