/// <summary> /// Removes all of the comments existing in the document /// </summary> public void RemoveAll() { //Removes comment-related tags inside the main document part IEnumerable <XElement> commentReferences = CommentReferences().ToList(); commentReferences.Remove(); WordprocessingCommentsPart commentsPart = parentDocument.Document.MainDocumentPart.WordprocessingCommentsPart; if (commentsPart != null) { parentDocument.RemovePart(commentsPart); } }
/// <summary> /// Removes the specified header in the document /// </summary> /// <param name="type">The header part type</param> public void RemoveHeader(HeaderType type) { OpenXmlPart headerPart = GetHeaderPart(type); parentDocument.RemovePart(headerPart); }
/// <summary> /// Removes the specified footer in the document /// </summary> /// <param name="type">The footer part type</param> public void RemoveFooter(FooterType type) { OpenXmlPart footerPart = GetFooterPart(type); parentDocument.RemovePart(footerPart); }