Class CommentRemover

java.lang.Object
pro.verron.officestamper.api.CommentRemover
All Implemented Interfaces:
PostProcessor

public class CommentRemover extends Object implements PostProcessor

The CommentRemover class is a concrete implementation of the PostProcessor interface. This class is responsible for removing all comments and their corresponding elements from a WordprocessingMLPackage document. It traverses the document, identifies comment elements, removes them from their parent contents, and clears the comments stored in the document's comments part.

Key responsibilities of this class include:

  1. Identifying all comment-related elements within the document using a CommentFinder instance.
  2. Removing those elements from their parent's content list.
  3. Accessing and clearing the document's comments part to ensure no residual comments remain.

This class is designed for scenarios where comments in a document need to be fully removed as part of preprocessing or cleanup operations.

  • Constructor Details

    • CommentRemover

      public CommentRemover()
      Build a CommentRemover instance
  • Method Details

    • process

      public void process(org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
      Description copied from interface: PostProcessor
      Processes a given WordprocessingMLPackage document. This method is typically used for performing operations such as modifying content, cleaning up the document structure, or applying other transformations.
      Specified by:
      process in interface PostProcessor
      Parameters:
      document - the WordprocessingMLPackage document to process