Page 1 of 1

How to remove all comments from docx file?

PostPosted: Thu Feb 07, 2013 6:27 am
by IndigoStar
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();

Re: How to remove all comments from docx file?

PostPosted: Thu Feb 07, 2013 7:43 am
by IndigoStar
I also posted this question on Stack Overflow: http://stackoverflow.com/questions/1473 ... ith-docx4j