How to remove all comments from docx file?
Posted: Thu Feb 07, 2013 6:27 am
Hello,
I'd like to remove all the comments from a docx file. I can remove the actual comments with a piece of code like is shown below, but I think I also need to remove the comment references from the main document part as well, but I can't figure out how to do that.
Any guidance appreciated!
Thanks.
CommentsPart cmtsPart = wordMLPackage.getMainDocumentPart().getCommentsPart();
org.docx4j.wml.Comments cmts = cpart.getJaxbElement();
List<Comments.Comment> coms = cmts.getComment();
coms.clear();
I'd like to remove all the comments from a docx file. I can remove the actual comments with a piece of code like is shown below, but I think I also need to remove the comment references from the main document part as well, but I can't figure out how to do that.
Any guidance appreciated!
Thanks.
CommentsPart cmtsPart = wordMLPackage.getMainDocumentPart().getCommentsPart();
org.docx4j.wml.Comments cmts = cpart.getJaxbElement();
List<Comments.Comment> coms = cmts.getComment();
coms.clear();